From: Hugh Dickins <hughd@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>,
Andrew Morton <akpm@linux-foundation.org>,
Lee Schermerhorn <lee.schermerhorn@hp.com>,
KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
David Rientjes <rientjes@google.com>,
Mel Gorman <mgorman@suse.de>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH 1/2] tmpfs mempolicy: fix /proc/mounts corrupting memory
Date: Wed, 2 Jan 2013 10:48:42 -0800 (PST) [thread overview]
Message-ID: <alpine.LNX.2.00.1301021031230.30549@eggly.anvils> (raw)
In-Reply-To: <CA+55aFyH63agfbf+pYNRGHaprPqAJF=F19GR6ASP_RhoyDGLdA@mail.gmail.com>
On Wed, 2 Jan 2013, Linus Torvalds wrote:
> On Wed, Jan 2, 2013 at 7:57 AM, Christoph Lameter <cl@linux.com> wrote:
> > On Wed, 2 Jan 2013, Hugh Dickins wrote:
> >
> >> @@ -2796,10 +2787,7 @@ int mpol_to_str(char *buffer, int maxlen
> >> case MPOL_BIND:
> >> /* Fall through */
> >> case MPOL_INTERLEAVE:
> >> - if (no_context)
> >> - nodes = pol->w.user_nodemask;
> >> - else
> >> - nodes = pol->v.nodes;
> >> + nodes = pol->v.nodes;
> >> break;
> >>
> >
> > no_context was always true. Why is the code from the false branch kept?
>
> no_context is zero in the caller in fs/proc/task_mmu.c, and one in the
> mm/shmem.c caller. So it's not always true (for mpol_parse_str() there
> is only one caller, and it's always true as Hugh said).
Yes, I think Christoph was remembering the old days when mpol_to_str()
started out just for tmpfs; later /proc/pid/numa_maps extended it for
use on vmas (the "contextualized" !no_context case).
>
> Anyway, I do not know why Hugh took the true case, but I don't really
> imagine that it matters. So I'll take these two patches, but it would
> be good if you double-checked this, Hugh.
Thanks, yes, I played with a number of ways of fixing it (and sat on my
original fix for several days, rightly guessing this an area where more
problems would emerge - only later realizing mpol=prefer:Node wrong too).
I could probably have kept mpol_to_str()'s no_context arg, and done
something with it in the MPOL_PREFERRED case; perhaps would have chosen
that if the arg had been more understandably named than "no_context";
but in the end thought removing the need for the arg was simplest.
Hugh
--
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>
next prev parent reply other threads:[~2013-01-02 18:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-02 10:01 Hugh Dickins
2013-01-02 10:04 ` [PATCH 2/2] mempolicy: remove arg from mpol_parse_str, mpol_to_str Hugh Dickins
2013-01-02 20:39 ` KOSAKI Motohiro
2013-01-02 14:32 ` [PATCH 1/2] tmpfs mempolicy: fix /proc/mounts corrupting memory Christoph Lameter
2013-01-02 18:30 ` Hugh Dickins
2013-01-02 15:57 ` Christoph Lameter
2013-01-02 17:24 ` Linus Torvalds
2013-01-02 17:27 ` Linus Torvalds
2013-01-02 18:48 ` Hugh Dickins [this message]
2013-01-02 20:38 ` KOSAKI Motohiro
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=alpine.LNX.2.00.1301021031230.30549@eggly.anvils \
--to=hughd@google.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=kosaki.motohiro@gmail.com \
--cc=lee.schermerhorn@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=rientjes@google.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox