Skip to content

Commit 80409c6

Browse files
jankaratorvalds
authored andcommitted
mm: migrate: make buffer_migrate_page_norefs() actually succeed
Currently, buffer_migrate_page_norefs() was constantly failing because buffer_migrate_lock_buffers() grabbed reference on each buffer. In fact, there's no reason for buffer_migrate_lock_buffers() to grab any buffer references as the page is locked during all our operation and thus nobody can reclaim buffers from the page. So remove grabbing of buffer references which also makes buffer_migrate_page_norefs() succeed. Link: http://lkml.kernel.org/r/20190116131217.7226-1-jack@suse.cz Fixes: 89cb088 "mm: migrate: provide buffer_migrate_page_norefs()" Signed-off-by: Jan Kara <jack@suse.cz> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: David Rientjes <rientjes@google.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Zi Yan <zi.yan@cs.rutgers.edu> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8fb335e commit 80409c6

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

mm/migrate.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ static bool buffer_migrate_lock_buffers(struct buffer_head *head,
709709
/* Simple case, sync compaction */
710710
if (mode != MIGRATE_ASYNC) {
711711
do {
712-
get_bh(bh);
713712
lock_buffer(bh);
714713
bh = bh->b_this_page;
715714

@@ -720,18 +719,15 @@ static bool buffer_migrate_lock_buffers(struct buffer_head *head,
720719

721720
/* async case, we cannot block on lock_buffer so use trylock_buffer */
722721
do {
723-
get_bh(bh);
724722
if (!trylock_buffer(bh)) {
725723
/*
726724
* We failed to lock the buffer and cannot stall in
727725
* async migration. Release the taken locks
728726
*/
729727
struct buffer_head *failed_bh = bh;
730-
put_bh(failed_bh);
731728
bh = head;
732729
while (bh != failed_bh) {
733730
unlock_buffer(bh);
734-
put_bh(bh);
735731
bh = bh->b_this_page;
736732
}
737733
return false;
@@ -818,7 +814,6 @@ static int __buffer_migrate_page(struct address_space *mapping,
818814
bh = head;
819815
do {
820816
unlock_buffer(bh);
821-
put_bh(bh);
822817
bh = bh->b_this_page;
823818

824819
} while (bh != head);

0 commit comments

Comments
 (0)