From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: Andi Kleen <ak@suse.de>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mel@skynet.ie,
eric.whitney@hp.com, clameter@sgi.com
Subject: Re: [PATCH/RFC 1/8] Mem Policy: Write lock mmap_sem while changing task mempolicy
Date: Thu, 06 Dec 2007 16:34:28 -0500 [thread overview]
Message-ID: <1196976868.5293.56.camel@localhost> (raw)
In-Reply-To: <200712062224.58812.ak@suse.de>
On Thu, 2007-12-06 at 22:24 +0100, Andi Kleen wrote:
> On Thursday 06 December 2007 22:20:53 Lee Schermerhorn wrote:
> > PATCH/RFC 01/08 Mem Policy: Write lock mmap_sem while changing task mempolicy
> >
> > Against: 2.6.24-rc2-mm1
> >
> > A read of /proc/<pid>/numa_maps holds the target task's mmap_sem
> > for read while examining each vma's mempolicy. A vma's mempolicy
> > can fall back to the task's policy. However, the task could be
> > changing it's task policy and free the one that the show_numa_maps()
> > is examining.
>
> But do_set_mempolicy doesn't actually modify the mempolicy. It just
> replaces it using essentially Copy-on-write.
>
> If the numa_maps holds a proper reference count (I haven't
> checked if it does) it can keep the old unmodified one as long as it wants.
>
> I don't think a write lock is needed.
Hi, Andi.
You are correct. But Christoph wants to avoid as many cases for having
to increment the reference count as possible and to simplify/eliminate
the tests of whether the increment/decrement is required. numa_maps
isn't a performance path, but it uses get_vma_policy()--same as used by
page allocation. If you look at patch 5, you'll see that I've
eliminated all extra references in this path, except the one taken by
shared policy lookup. The new 'mpol_cond_free()' [and
mpol_need_cond_unref() helper--used in alloc_page_vma() "slow path"]
only trigger for shared policy now. This is a single test of the
mempolicy mode [formerly policy] member that should be cache hot, if not
actually in a register.
This was what Christoph was trying to achieve, I think.
Lee
--
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:[~2007-12-06 21:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 21:20 [PATCH/RFC 0/8] Mem Policy: More Reference Counting/Fallback Fixes and Misc Cleanups Lee Schermerhorn
2007-12-06 21:20 ` [PATCH/RFC 1/8] Mem Policy: Write lock mmap_sem while changing task mempolicy Lee Schermerhorn
2007-12-06 21:24 ` Andi Kleen
2007-12-06 21:34 ` Lee Schermerhorn [this message]
2007-12-06 21:20 ` [PATCH/RFC 2/8] Mem Policy: Fixup Fallback for Default Shmem Policy Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 3/8] Mem Policy: Mark shared policies for unref Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 4/8] Mem Policy: Document {set|get}_policy() vm_ops APIs Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 5/8] Mem Policy: Rework mempolicy Reference Counting [yet again] Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 6/8] Mem Policy: Use MPOL_PREFERRED for system-wide default policy Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 7/8] Mem Policy: MPOL_PREFERRED cleanups for "local allocation" Lee Schermerhorn
2007-12-06 21:21 ` [PATCH/RFC 8/8] Mem Policy: Fix up MPOL_BIND documentation Lee Schermerhorn
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=1196976868.5293.56.camel@localhost \
--to=lee.schermerhorn@hp.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=eric.whitney@hp.com \
--cc=linux-mm@kvack.org \
--cc=mel@skynet.ie \
/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;
as well as URLs for NNTP newsgroup(s).