LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2008, 04:21 AM   #1
heroma
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Rep: Reputation: 0
Big kernel lock in 2.6.10


Hi everybody,I have some questions in scheduling and locking the kernel (Big Kernel Lock) in kernel 2.6.10:
1. Is it posible that one process invoke lock_kernel() for more than onc? In other word can lock_depth have positive value means more than zero?

2. If process A catch the lock of kernel (with invoking lock_kernel()) and after it’s timestamp scheduler release kernel lock from process A with(release_kernel_lock(prev) in kernel_lock.c) and scheduler give the lock to process B, what happen for the data structures of the kernel that process A change them and process A need them again? Can B manipulates them? After that process A reacquire kernel lock from where continue it’s executing?

3. How can a process reacquire big kernel lock?


4. From where scheduler know that one process (not current) need kernel lock while it’s lock_depth=-1 before invoking lock_depth?
Best regards.
 
Old 06-04-2008, 08:50 PM   #2
nuxrl
Member
 
Registered: Jun 2006
Location: NY, USA
Distribution: Slackware, Arch
Posts: 176

Rep: Reputation: 35
Quote:
Originally Posted by heroma View Post
Hi everybody,I have some questions in scheduling and locking the kernel (Big Kernel Lock) in kernel 2.6.10:
1. Is it posible that one process invoke lock_kernel() for more than onc? In other word can lock_depth have positive value means more than zero?
It's possible.

Quote:
2. If process A catch the lock of kernel (with invoking lock_kernel()) and after it’s timestamp scheduler release kernel lock from process A with(release_kernel_lock(prev) in kernel_lock.c) and scheduler give the lock to process B, what happen for the data structures of the kernel that process A change them and process A need them again? Can B manipulates them? After that process A reacquire kernel lock from where continue it’s executing?
B could change them. After reacquiring the bkl, A will continue from where it was left out.

Quote:
3. How can a process reacquire big kernel lock?
Use lock_kernel().

Quote:
4. From where scheduler know that one process (not current) need kernel lock while it’s lock_depth=-1 before invoking lock_depth?
Best regards.
When process A needs to relinquish the CPU, schedule() will release the bkl, but lock_depth in A's task_struct is not reset to -1. So, the A is scheduled to run again, the scheduler knows A needs to acquire the bkl.

Please note, up to 2.6.10, the bkl is implemented using a spin_lock. Since 2.6.11, it's a semaphore.

Last edited by nuxrl; 06-04-2008 at 08:52 PM.
 
Old 06-05-2008, 03:17 AM   #3
heroma
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Thank you very much! I know that from 2.6.11 to now it implements with semaphore but my research is in 2.6.10

1. as you say the scheduler gives the time to "A"(never another one like "B") again after invoking release_kernel_lock(). so why scheduler invokes release_kernel_lock()?


2. I understand from your speech that BKL in 2.6.10 and before was very bad.
you think that process "A" gives BKL and invokes unlock_kernel() after some times scheduler gives the time to it again, while it's lock_depth=0 then scheduler gives BKL to it again while it does'nt need it. is it true?

3. you say that lock_kernel() can be invoken more than once by a process but in unlock_kernel() we have if(likely(--current->lock_depth<0) --unlock_kernel(); so when lock_depth!=0 never BKL will be freed and it has made a dealock. is it true?
 
Old 06-05-2008, 12:17 PM   #4
heroma
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Ah, sorry! something forgotten!
how other process (that has't BKL now)understand that they can't come in to kernel?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Removing the Big Kernel Lock LXer Syndicated Linux News 0 05-16-2008 11:50 AM
LXer: Why Big Compute and Big Storage will meet Big Pipe at the Last Mile LXer Syndicated Linux News 0 12-23-2007 01:20 PM
Hard lock plus Caps and Scroll Lock flashing (kernel panic?) TiredOfThis Linux - General 4 12-11-2007 07:35 PM
Lock-up on boot after kernel upgrade wheaties_box Linux - General 2 12-09-2006 01:41 PM
Kernel Crash results in X Server Lock up eqxro Linux - Software 0 06-29-2004 02:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration