All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Michel Lespinasse <walken@google.com>,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	aswin@hp.com, scott.norton@hp.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] mm: per-thread vma caching
Date: Mon, 3 Mar 2014 19:26:01 -0800	[thread overview]
Message-ID: <20140303192601.5374b330.akpm@linux-foundation.org> (raw)
In-Reply-To: <1393902810.30648.36.camel@buesod1.americas.hpqcorp.net>

On Mon, 03 Mar 2014 19:13:30 -0800 Davidlohr Bueso <davidlohr@hp.com> wrote:

> On Mon, 2014-03-03 at 19:12 -0800, Andrew Morton wrote:
> > On Mon, 03 Mar 2014 18:42:33 -0800 Davidlohr Bueso <davidlohr@hp.com> wrote:
> > 
> > > On Mon, 2014-03-03 at 17:23 -0800, Andrew Morton wrote:
> > > > On Mon, 03 Mar 2014 16:59:38 -0800 Davidlohr Bueso <davidlohr@hp.com> wrote:
> > > > 
> > > > > > >...
> > > > > > >
> > > > > > > +static bool vmacache_valid(struct mm_struct *mm)
> > > > > > > +{
> > > > > > > +	struct task_struct *curr = current;
> > > > > > > +
> > > > > > > +	if (mm != curr->mm)
> > > > > > > +		return false;
> > > > > > 
> > > > > > What's going on here?  Handling a task poking around in someone else's
> > > > > > mm?  I'm thinking "__access_remote_vm", but I don't know what you were
> > > > > > thinking ;) An explanatory comment would be revealing.
> > > > > 
> > > > > I don't understand the doubt here. Seems like a pretty obvious thing to
> > > > > check -- yes it's probably unlikely but we certainly don't want to be
> > > > > validating the cache on an mm that's not ours... or are you saying it's
> > > > > redundant??
> > > > 
> > > > Well it has to be here for a reason and I'm wondering that that reason
> > > > is.  If nobody comes here with a foreign mm then let's remove it.
> > > 
> > > find_vma() can be called by concurrent threads sharing the mm->mmap_sem
> > > for reading, thus this check needs to be there.
> > 
> > Confused.  If the threads share mm->mmap_sem then they share mm and the
> > test will always be false?
> 
> Yes, I shortly realized that was silly... but I can say for sure it can
> happen and a quick qemu run confirms it. So I see your point as to
> asking why we need it, so now I'm looking for an explanation in the
> code.

Great, please do.  We may well find that we have buggy (or at least
inefficient) callers, which we can fix.



--
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>

  reply	other threads:[~2014-03-04  3:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 21:48 [PATCH v4] mm: per-thread vma caching Davidlohr Bueso
2014-02-27 21:48 ` Davidlohr Bueso
2014-02-28  4:39 ` Davidlohr Bueso
2014-02-28  4:39   ` Davidlohr Bueso
2014-03-04  0:00 ` Andrew Morton
2014-03-04  0:18   ` Davidlohr Bueso
2014-03-04  0:18     ` Davidlohr Bueso
2014-03-04  0:40 ` Andrew Morton
2014-03-04  0:59   ` Davidlohr Bueso
2014-03-04  0:59     ` Davidlohr Bueso
2014-03-04  1:23     ` Andrew Morton
2014-03-04  2:42       ` Davidlohr Bueso
2014-03-04  2:42         ` Davidlohr Bueso
2014-03-04  3:12         ` Andrew Morton
2014-03-04  3:13           ` Davidlohr Bueso
2014-03-04  3:13             ` Davidlohr Bueso
2014-03-04  3:26             ` Andrew Morton [this message]
2014-03-04  3:26             ` Linus Torvalds
2014-03-04  3:26               ` Linus Torvalds
2014-03-04  5:32               ` Davidlohr Bueso
2014-03-04  5:32                 ` Davidlohr Bueso
2014-03-14  3:05               ` Li Zefan
2014-03-14  3:05                 ` Li Zefan
2014-03-14  4:43                 ` Andrew Morton
2014-03-14  4:43                   ` Andrew Morton
2014-03-06 22:56     ` Andrew Morton
2014-03-06 22:56       ` Andrew Morton
     [not found] ` <20140308184040.GA29602@redhat.com>
     [not found]   ` <CA+55aFw88xiY+o5FE6VtHNkpUZDK3FPt31oCpNsgn1BH7wAPZw@mail.gmail.com>
2014-03-08 19:57     ` Oleg Nesterov
     [not found]     ` <20140308194405.GA32403@redhat.com>
2014-03-08 20:02       ` Linus Torvalds
2014-03-09  3:22         ` Davidlohr Bueso
2014-03-09 12:57         ` Oleg Nesterov
2014-03-09 15:57           ` Linus Torvalds
2014-03-09 17:09             ` Oleg Nesterov
2014-03-09 17:16               ` Linus Torvalds
2014-03-10 19:56                 ` [PATCH -next] mm,vmacache: also flush cache for VM_CLONE Davidlohr Bueso
2014-03-13 14:59                   ` Oleg Nesterov
2014-03-13 15:32                     ` Oleg Nesterov
2014-03-13 19:04                       ` Davidlohr Bueso
     [not found]                     ` <CA+55aFyNd7L+G3hFauJPxUOengK-_o2G-SFmVooPZ-sE6xBj=g@mail.gmail.com>
2014-03-13 16:36                       ` Oleg Nesterov
2014-03-13 18:27                         ` async_pf.c && use_mm() (Was: mm,vmacache: also flush cache for VM_CLONE) Oleg Nesterov
     [not found]                           ` <CA+55aFwqTbsYCyPf6_i6RmBkPHpEhJjiRfZm6_1_yPa_kUkYiQ@mail.gmail.com>
2014-03-13 21:44                             ` Linus Torvalds
2014-03-14 18:23                               ` Oleg Nesterov

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=20140303192601.5374b330.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aswin@hp.com \
    --cc=davidlohr@hp.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=scott.norton@hp.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.com \
    /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.