mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Btrfs: Reduce contention on the root node
This calls unlock_up sooner in btrfs_search_slot in order to decrease the amount of work done with the higher level tree locks held. Also, it changes btrfs_tree_lock to spin for a big against the page lock before scheduling. This makes a big difference in context switch rate under highly contended workloads. Longer term, a better locking structure is needed than the page lock. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
3f157a2fd2
commit
f9efa9c784
2 changed files with 21 additions and 6 deletions
|
@ -27,6 +27,16 @@
|
|||
|
||||
int btrfs_tree_lock(struct extent_buffer *eb)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!TestSetPageLocked(eb->first_page))
|
||||
return 0;
|
||||
for (i = 0; i < 512; i++) {
|
||||
cpu_relax();
|
||||
if (!TestSetPageLocked(eb->first_page))
|
||||
return 0;
|
||||
}
|
||||
cpu_relax();
|
||||
lock_page(eb->first_page);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue