All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.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>,
	"Chandramouleeswaran, Aswin" <aswin@hp.com>,
	"Norton, Scott J" <scott.norton@hp.com>,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm: per-thread vma caching
Date: Tue, 25 Feb 2014 10:45:51 -0800	[thread overview]
Message-ID: <CA+55aFxdUOALfQketaSAA9B_Da+n=hSvC5XswV+5cpmnyLwiFw@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFzPYZnkSQa=Y4Uo3zMVUVdchVxN2S266KyZLu-yJ314pw@mail.gmail.com>

On Tue, Feb 25, 2014 at 10:37 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
>  - clear all the cache entries (of the new 'struct task_struct'! - so
> not in dup_mmap, but make sure it's zeroed when allocating!)(
>
>  - set vmcache_seqnum to 0 in dup_mmap (since any sequence number is
> fine when it got invalidated, and 0 is best for "avoid overflow").

Btw, as far as I can tell, that also makes the per-thread vmacache
automatically do the right thing for the non-MMU case, so that you
could just remove the difference between CONFIG_MMU and NOMMU.

Basically, dup_mmap() should no longer have anything to do with the
vmacache, since it is now per-thread, not per-mm.

So :

 - allocating a new "struct mm_struct" should clear the
vmacache_seqnum for that new mm, to try to minimize unnecessary future
overflow.

 - thread allocation should just zero the cache entries, and set
"tsk->vmacache_seqnum = mm->vmacache_seqnum" (after dup_mm()) to avoid
future unnecessary flushes.

and as far as I can tell, the logic would be exactly the same on NOMMU
(the dup_mm just doesn't happen, since all forks are basically sharing
mm).

And maybe you'd want to make VMACACHE_SIZE be 1 on NOMMU (and make
sure to change the "& 3" to "& (VMACACHE_SIZE-1)". Just to keep the
size down on small systems that really don't need it.

          Linus

WARNING: multiple messages have this Message-ID (diff)
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.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>,
	"Chandramouleeswaran, Aswin" <aswin@hp.com>,
	"Norton, Scott J" <scott.norton@hp.com>,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm: per-thread vma caching
Date: Tue, 25 Feb 2014 10:45:51 -0800	[thread overview]
Message-ID: <CA+55aFxdUOALfQketaSAA9B_Da+n=hSvC5XswV+5cpmnyLwiFw@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFzPYZnkSQa=Y4Uo3zMVUVdchVxN2S266KyZLu-yJ314pw@mail.gmail.com>

On Tue, Feb 25, 2014 at 10:37 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
>  - clear all the cache entries (of the new 'struct task_struct'! - so
> not in dup_mmap, but make sure it's zeroed when allocating!)(
>
>  - set vmcache_seqnum to 0 in dup_mmap (since any sequence number is
> fine when it got invalidated, and 0 is best for "avoid overflow").

Btw, as far as I can tell, that also makes the per-thread vmacache
automatically do the right thing for the non-MMU case, so that you
could just remove the difference between CONFIG_MMU and NOMMU.

Basically, dup_mmap() should no longer have anything to do with the
vmacache, since it is now per-thread, not per-mm.

So :

 - allocating a new "struct mm_struct" should clear the
vmacache_seqnum for that new mm, to try to minimize unnecessary future
overflow.

 - thread allocation should just zero the cache entries, and set
"tsk->vmacache_seqnum = mm->vmacache_seqnum" (after dup_mm()) to avoid
future unnecessary flushes.

and as far as I can tell, the logic would be exactly the same on NOMMU
(the dup_mm just doesn't happen, since all forks are basically sharing
mm).

And maybe you'd want to make VMACACHE_SIZE be 1 on NOMMU (and make
sure to change the "& 3" to "& (VMACACHE_SIZE-1)". Just to keep the
size down on small systems that really don't need it.

          Linus

--
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-02-25 18:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 18:16 [PATCH v2] mm: per-thread vma caching Davidlohr Bueso
2014-02-25 18:16 ` Davidlohr Bueso
2014-02-25 18:24 ` Rik van Riel
2014-02-25 18:24   ` Rik van Riel
2014-02-25 18:36   ` Davidlohr Bueso
2014-02-25 18:36     ` Davidlohr Bueso
2014-02-25 18:35 ` Peter Zijlstra
2014-02-25 18:35   ` Peter Zijlstra
2014-02-25 18:37   ` Davidlohr Bueso
2014-02-25 18:37     ` Davidlohr Bueso
2014-02-25 19:46     ` Peter Zijlstra
2014-02-25 19:46       ` Peter Zijlstra
2014-02-25 18:37 ` Linus Torvalds
2014-02-25 18:37   ` Linus Torvalds
2014-02-25 18:45   ` Linus Torvalds [this message]
2014-02-25 18:45     ` Linus Torvalds
2014-02-25 19:04   ` Davidlohr Bueso
2014-02-25 19:04     ` Davidlohr Bueso
2014-02-25 19:30     ` Davidlohr Bueso
2014-02-25 19:30       ` Davidlohr Bueso
2014-02-25 19:31     ` Linus Torvalds
2014-02-25 19:31       ` Linus Torvalds
2014-02-26  2:04 ` Michel Lespinasse
2014-02-26  2:04   ` Michel Lespinasse
2014-02-26  4:04   ` Davidlohr Bueso
2014-02-26  4:04     ` Davidlohr Bueso
2014-02-26  7:52     ` Michel Lespinasse
2014-02-26  7:52       ` Michel Lespinasse
2014-02-26  8:50 ` Peter Zijlstra
2014-02-26  8:50   ` Peter Zijlstra
2014-02-26  8:55   ` Peter Zijlstra
2014-02-26  8:55     ` Peter Zijlstra
2014-02-26 11:26 ` Mel Gorman
2014-02-26 11:26   ` Mel Gorman
2014-02-26 19:11   ` Davidlohr Bueso
2014-02-26 19:11     ` Davidlohr Bueso

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='CA+55aFxdUOALfQketaSAA9B_Da+n=hSvC5XswV+5cpmnyLwiFw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=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=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.