All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH 1/6] mm: khugepaged: fix radix tree node leak in shmem collapse error path
Date: Mon, 14 Nov 2016 11:48:22 -0500	[thread overview]
Message-ID: <20161114164822.GB5141@cmpxchg.org> (raw)
In-Reply-To: <20161114155250.GB3291@cmpxchg.org>

On Mon, Nov 14, 2016 at 10:52:50AM -0500, Johannes Weiner wrote:
> On Mon, Nov 14, 2016 at 05:29:02PM +0300, Kirill A. Shutemov wrote:
> > @@ -1400,7 +1400,9 @@ static void collapse_shmem(struct mm_struct *mm,
> >  					PAGE_SIZE, 0);
> >  
> >  		spin_lock_irq(&mapping->tree_lock);
> > -
> > +		slot = radix_tree_lookup_slot(&mapping->page_tree, index);
> > +		VM_BUG_ON_PAGE(page != radix_tree_deref_slot_protected(slot,
> > +					&mapping->tree_lock), page);
> >  		VM_BUG_ON_PAGE(page_mapped(page), page);
> 
> That looks good to me. The slot may get relocated, but the content
> shouldn't change with the page locked.
> 
> Are you going to send a full patch with changelog and sign-off? If so,
> please add:
> 
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>

Just to clarify, this is in addition to my radix_tree_iter_next()
change. The iterator still needs to be reloaded because the number of
valid slots that come after the current one can change as well.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH 1/6] mm: khugepaged: fix radix tree node leak in shmem collapse error path
Date: Mon, 14 Nov 2016 11:48:22 -0500	[thread overview]
Message-ID: <20161114164822.GB5141@cmpxchg.org> (raw)
In-Reply-To: <20161114155250.GB3291@cmpxchg.org>

On Mon, Nov 14, 2016 at 10:52:50AM -0500, Johannes Weiner wrote:
> On Mon, Nov 14, 2016 at 05:29:02PM +0300, Kirill A. Shutemov wrote:
> > @@ -1400,7 +1400,9 @@ static void collapse_shmem(struct mm_struct *mm,
> >  					PAGE_SIZE, 0);
> >  
> >  		spin_lock_irq(&mapping->tree_lock);
> > -
> > +		slot = radix_tree_lookup_slot(&mapping->page_tree, index);
> > +		VM_BUG_ON_PAGE(page != radix_tree_deref_slot_protected(slot,
> > +					&mapping->tree_lock), page);
> >  		VM_BUG_ON_PAGE(page_mapped(page), page);
> 
> That looks good to me. The slot may get relocated, but the content
> shouldn't change with the page locked.
> 
> Are you going to send a full patch with changelog and sign-off? If so,
> please add:
> 
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>

Just to clarify, this is in addition to my radix_tree_iter_next()
change. The iterator still needs to be reloaded because the number of
valid slots that come after the current one can change as well.

  reply	other threads:[~2016-11-14 16:48 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 19:07 [PATCH 0/6] mm: workingset: radix tree subtleties & single-page file refaults Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 1/6] mm: khugepaged: fix radix tree node leak in shmem collapse error path Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08  9:53   ` Jan Kara
2016-11-08  9:53     ` Jan Kara
2016-11-08 16:12     ` Johannes Weiner
2016-11-08 16:12       ` Johannes Weiner
2016-11-09  7:41       ` Jan Kara
2016-11-09  7:41         ` Jan Kara
2016-11-11 10:59       ` Kirill A. Shutemov
2016-11-11 10:59         ` Kirill A. Shutemov
2016-11-11 12:22         ` Jan Kara
2016-11-11 12:22           ` Jan Kara
2016-11-11 16:37           ` Kirill A. Shutemov
2016-11-11 16:37             ` Kirill A. Shutemov
2016-11-14  8:07             ` Jan Kara
2016-11-14  8:07               ` Jan Kara
2016-11-14 14:29               ` Kirill A. Shutemov
2016-11-14 14:29                 ` Kirill A. Shutemov
2016-11-14 15:52                 ` Johannes Weiner
2016-11-14 15:52                   ` Johannes Weiner
2016-11-14 16:48                   ` Johannes Weiner [this message]
2016-11-14 16:48                     ` Johannes Weiner
2016-11-14 19:40                     ` Kirill A. Shutemov
2016-11-14 19:40                       ` Kirill A. Shutemov
2016-11-15 14:00                       ` Johannes Weiner
2016-11-15 14:00                         ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 2/6] mm: workingset: turn shadow node shrinker bugs into warnings Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08  9:57   ` Jan Kara
2016-11-08  9:57     ` Jan Kara
2016-11-07 19:07 ` [PATCH 3/6] lib: radix-tree: native accounting of exceptional entries Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08 10:08   ` Jan Kara
2016-11-08 10:08     ` Jan Kara
2016-11-07 19:07 ` [PATCH 4/6] lib: radix-tree: check accounting of existing slot replacement users Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08 10:12   ` Jan Kara
2016-11-08 10:12     ` Jan Kara
2016-11-07 19:07 ` [PATCH 5/6] mm: workingset: switch shadow entry tracking to radix tree exceptional counting Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08 10:27   ` Jan Kara
2016-11-08 10:27     ` Jan Kara
2016-11-08 19:30     ` Johannes Weiner
2016-11-08 19:30       ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 6/6] mm: workingset: restore refault tracking for single-page files Johannes Weiner
2016-11-07 19:07   ` Johannes Weiner
2016-11-08 10:31   ` Jan Kara
2016-11-08 10:31     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161114164822.GB5141@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=kernel-team@fb.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.