linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ethan Solomita <solo@google.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Christoph Lameter <clameter@sgi.com>
Subject: Re: [PATCH 1/6] cpuset write dirty map
Date: Sat, 15 Sep 2007 05:17:48 +0530	[thread overview]
Message-ID: <a781481a0709141647q3d019423s388c64bf6bed871a@mail.gmail.com> (raw)
In-Reply-To: <20070914161536.3ec5c533.akpm@linux-foundation.org>

On 9/15/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Tue, 11 Sep 2007 18:36:34 -0700
> Ethan Solomita <solo@google.com> wrote:

> > The dirty map may be stored either directly in the mapping (for NUMA
> > systems with less then BITS_PER_LONG nodes) or separately allocated
> > for systems with a large number of nodes (f.e. IA64 with 1024 nodes).

> > --- 0/include/linux/fs.h      2007-09-11 14:35:58.000000000 -0700
> > +++ 1/include/linux/fs.h      2007-09-11 14:36:24.000000000 -0700
> > @@ -516,6 +516,13 @@ struct address_space {
> >       spinlock_t              private_lock;   /* for use by the address_space */
> >       struct list_head        private_list;   /* ditto */
> >       struct address_space    *assoc_mapping; /* ditto */
> > +#ifdef CONFIG_CPUSETS
> > +#if MAX_NUMNODES <= BITS_PER_LONG
> > +     nodemask_t              dirty_nodes;    /* nodes with dirty pages */
> > +#else
> > +     nodemask_t              *dirty_nodes;   /* pointer to map if dirty */
> > +#endif
> > +#endif
>
> afacit there is no code comment and no changelog text which explains the
> above design decision?  There should be, please.

> > +/*
> > + * Special functions for NUMA systems with a large number of nodes.
> > + * The nodemask is pointed to from the address space structures.
> > + * The attachment of the dirty_node mask is protected by the
> > + * tree_lock. The nodemask is freed only when the inode is cleared
> > + * (and therefore unused, thus no locking necessary).
> > + */
>
> hmm, OK, there's a hint as to wghat's going on.
>
> It's unobvious why the break point is at MAX_NUMNODES = BITS_PER_LONG and
> we might want to tweak that in the future.  Yet another argument for
> centralising this comparison.

Looks like just an optimization to me ... Ethan wants to economize and not bloat
struct address_space too much.

So, if sizeof(nodemask_t) == sizeof(long), i.e. when:
MAX_NUMNODES <= BITS_PER_LONG, then we'll be adding only sizeof(long)
extra bytes to the struct (by plonking the object itself into it).

But even when MAX_NUMNODES > BITS_PER_LONG, because we're storing
a pointer, and because sizeof(void *) == sizeof(long), so again the maximum
bloat addition to struct address_space would only be sizeof(long) bytes.

I didn't see the original mail, but if the #ifdeffery for this
conditional is too much
as a result of this optimization, Ethan should probably just do away
with all of it
entirely, and simply put a full nodemask_t object (irrespective of MAX_NUMNODES)
into the struct. After all, struct task_struct does the same unconditionally ...
but admittedly, there are several times more address_space struct's resident in
memory at any given time than there are task_struct's, so this optimization does
make sense too ...


> > +             if (!nodes)
> > +                     return;
> > +
> > +             *nodes = NODE_MASK_NONE;
> > +             mapping->dirty_nodes = nodes;
> > +     }
> > +
> > +     if (!node_isset(node, *nodes))
> > +             node_set(node, *nodes);
> > +}
> > +
> > +void cpuset_clear_dirty_nodes(struct address_space *mapping)
> > +{
> > +     nodemask_t *nodes = mapping->dirty_nodes;
> > +
> > +     if (nodes) {
> > +             mapping->dirty_nodes = NULL;
> > +             kfree(nodes);
> > +     }
> > +}
>
> Can this race with cpuset_update_dirty_nodes()?  And with itself?  If not,
> a comment which describes the locking requirements would be good.
>
> > +/*
> > + * Called without the tree_lock. The nodemask is only freed when the inode
> > + * is cleared and therefore this is safe.
> > + */
> > +int cpuset_intersects_dirty_nodes(struct address_space *mapping,
> > +                     nodemask_t *mask)
> > +{
> > +     nodemask_t *dirty_nodes = mapping->dirty_nodes;
> > +
> > +     if (!mask)
> > +             return 1;
> > +
> > +     if (!dirty_nodes)
> > +             return 0;
> > +
> > +     return nodes_intersects(*dirty_nodes, *mask);
> > +}
> > +#endif
> > +

--
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:[~2007-09-14 23:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 21:23 [PATCH 0/6] cpuset aware writeback Ethan Solomita
2007-07-17 21:32 ` [PATCH 1/6] cpuset write dirty map Ethan Solomita
2007-07-17 21:33 ` [PATCH 2/6] cpuset write pdflush nodemask Ethan Solomita
2007-07-17 21:34 ` [PATCH 3/6] cpuset write throttle Ethan Solomita
2007-07-17 21:35 ` [PATCH 4/6] cpuset write vmscan Ethan Solomita
2007-07-17 21:36 ` [PATCH 5/6] cpuset write vm writeout Ethan Solomita
2007-07-17 21:37 ` [PATCH 6/6] cpuset dirty limits Ethan Solomita
2007-07-23 20:18 ` [PATCH 0/6] cpuset aware writeback Christoph Lameter
2007-07-23 21:30   ` Ethan Solomita
2007-07-23 21:53     ` Christoph Lameter
2007-09-12  1:32 ` Ethan Solomita
2007-09-12  1:36   ` [PATCH 1/6] cpuset write dirty map Ethan Solomita
2007-09-14 23:15     ` Andrew Morton
2007-09-14 23:47       ` Satyam Sharma [this message]
2007-09-15  0:07         ` Andrew Morton
2007-09-15  0:16           ` Satyam Sharma
2007-09-17 18:37             ` Mike Travis
2007-09-17 19:10       ` Christoph Lameter
2007-09-19  0:51       ` Ethan Solomita
2007-09-19  2:14         ` Andrew Morton
2007-09-19 17:08           ` Christoph Lameter
2007-09-19 17:06         ` Christoph Lameter
2007-09-12  1:38   ` [PATCH 2/6] cpuset write pdflush nodemask Ethan Solomita
2007-09-12  1:39   ` [PATCH 3/6] cpuset write throttle Ethan Solomita
     [not found]     ` <20070914161517.5ea3847f.akpm@linux-foundation.org>
2007-10-03  0:38       ` Ethan Solomita
2007-10-03 17:46         ` Christoph Lameter
2007-10-03 20:46           ` Ethan Solomita
2007-10-04  3:56             ` Christoph Lameter
2007-10-04  7:37               ` Peter Zijlstra
2007-10-04  7:56                 ` Paul Jackson
2007-10-04  8:15                   ` Peter Zijlstra
2007-10-04  8:25                     ` Peter Zijlstra
2007-10-04  9:06                       ` Paul Jackson
2007-10-04  9:04                     ` Paul Jackson
2007-10-05 19:34                 ` Ethan Solomita
2007-09-12  1:40   ` [PATCH 4/6] cpuset write vmscan Ethan Solomita
2007-09-12  1:41   ` [PATCH 5/6] cpuset write vm writeout Ethan Solomita
2007-09-12  1:42   ` [PATCH 6/6] cpuset dirty limits Ethan Solomita
2007-09-14 23:15     ` Andrew Morton
2007-09-17 19:00       ` Christoph Lameter
2007-09-19  0:23         ` Ethan Solomita

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=a781481a0709141647q3d019423s388c64bf6bed871a@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=solo@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 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).