Skip to content

Commit a978d6f

Browse files
Nick Piggintorvalds
authored andcommitted
mm: unlockless reclaim
unlock_page is fairly expensive. It can be avoided in page reclaim success path. By definition if we have any other references to the page it would be a bug anyway. Signed-off-by: Nick Piggin <[email protected]> Reviewed-by: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f45840b commit a978d6f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mm/vmscan.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,14 @@ static unsigned long shrink_page_list(struct list_head *page_list,
732732
if (!mapping || !__remove_mapping(mapping, page))
733733
goto keep_locked;
734734

735-
unlock_page(page);
735+
/*
736+
* At this point, we have no other references and there is
737+
* no way to pick any more up (removed from LRU, removed
738+
* from pagecache). Can use non-atomic bitops now (and
739+
* we obviously don't have to worry about waking up a process
740+
* waiting on the page lock, because there are no references.
741+
*/
742+
__clear_page_locked(page);
736743
free_it:
737744
nr_reclaimed++;
738745
if (!pagevec_add(&freed_pvec, page)) {

0 commit comments

Comments
 (0)