public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: linux-kernel@vger.kernel.org, mbligh@aracnet.com, akpm@osdl.org,
	wli@holomorphy.com, haveblue@us.ibm.com, hch@infradead.org
Subject: Re: [PATCH] Introduce nodemask_t ADT [0/7]
Date: Thu, 18 Mar 2004 17:19:44 -0800	[thread overview]
Message-ID: <1079659184.8149.355.camel@arrakis> (raw)
In-Reply-To: <20040318165957.592e49d3.pj@sgi.com>

On Thu, 2004-03-18 at 16:59, Paul Jackson wrote:
> Your nodemask_t reminds me of something I posted to linux-ia64 last
> November 7, 2004, under the subject: "[PATCH preview] Adds nodemask_t
> for use in cpusets (NUMA memory placement)".
> 
> Chris Hellwig responded to it at the time asking why I didn't provide a
> single generic mask ADT, and make cpumask and nodemask instances of
> that.

That is a better idea, if it can be made to work.  My goal is to stop
the proliferation of open-coded references to node details as soon as
possible.  If we we nip this behavior in the bud and convert all users
of cpu/node data to cpumask_t/nodemask_t, we can (more) easily change
the underlying details of how all the cpumask and nodemask functions
work later.  If the users all call our macros, then it's easy to find
them ('grep -r "nodes_and" *' vs searching for every '&' in the kernel
that may or may not be a node or cpu mask) and test them.

> I coded that up, but then got distracted.  The remaining issue for which
> I didn't have a good answer was that my proposal would break the optimum
> handling for sparc64 or other systems that didn't handle passing
> structures on the stack efficiently.
> 
> Bill Irwin was a party to my discussions of that effort, so I presume
> that if he felt it had further merit, he would have mentioned it to
> you, Matthew.

He never mentioned it to me when I queried him for details on his
cpumask_t implementation...

> Could one of you, Bill or Matthew, speak to why this generic mask ADT,
> underlying both cpumask and nodemask, should not be pursued further,
> instead of duplicating the various details of cpumask, after a global
> s/cpu/node/g change?

Nope.  I think it should.  Though it is hard to optimize for generic
masks.  We've got the bitmap_* functions which work nicely for unsigned
long[].  These (cpumask_t/nodemask_t) are nice because they are
optimized for edge cases (UP for cpumask_t and Non-NUMA for nodemask_t)
as well as for long mask cases (passing by structs reference).  It's
hard to make those types of optimizations on generic masks.

> I am attaching the header file include/linux/mask.h for my current
> version of this mask.h, in case someone reading wants more specifics of
> what it is that I am referring to.
> 
> This version almost certainly does _not_ work on big endian 64 systems,
> due to my ignorance of how kernel bitmasks were layed out when I last
> worked on this mask.h header.  Unlike the sparc64 performance issues
> with passing structs on the stack, I would hope that the big/little
> endian issues could be fixed without messing things up too much.
> 
> If this mask.h could actually be made to work, including on sparc64,
> then it would seem to be a much cleaner solution.  With it, we would
> define cpumask_t and nodemask_t as simply:
> 
>   typedef __mask(NR_NODES) nodemask_t;
>   typedef __mask(NR_CPUS) cpumask_t;
> 
> and either use operations such as mask_and() on both, or if one insisted
> on keeping operations that specifically called out cpumask, add some
> 15 trivial defines such as:
> 
>   #define cpumask_and(dst, src1, src2) mask_and(dst, src1, src2)

I'll look it over and see how it looks.  As I said, I'm very much for a
generic mask type if we can do it properly and efficiently.

Cheers!

-Matt


  reply	other threads:[~2004-03-19  1:20 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 23:04 [PATCH] Introduce nodemask_t ADT [0/7] Matthew Dobson
2004-03-18 23:23 ` Jesse Barnes
2004-03-18 23:32   ` Martin J. Bligh
2004-03-18 23:37     ` Jesse Barnes
2004-03-18 23:43       ` Martin J. Bligh
2004-03-18 23:59         ` Jesse Barnes
2004-03-19 16:20           ` Martin J. Bligh
2004-03-19  0:58         ` Zwane Mwaikambo
2004-03-19  1:11           ` Jesse Barnes
2004-03-19  1:34             ` Zwane Mwaikambo
2004-03-19  1:40               ` Jesse Barnes
2004-03-19  1:08         ` Paul Jackson
2004-03-19  0:01     ` Matthew Dobson
2004-03-18 23:58   ` Matthew Dobson
2004-03-19  2:55   ` William Lee Irwin III
2004-03-19  0:59 ` Paul Jackson
2004-03-19  1:19   ` Matthew Dobson [this message]
2004-03-19  1:45     ` Paul Jackson
2004-03-19 22:51       ` Matthew Dobson
2004-03-19 23:42         ` Paul Jackson
2004-03-19  1:48     ` Paul Jackson
2004-03-19  1:56     ` Paul Jackson
2004-03-19 23:02       ` Matthew Dobson
2004-03-20  0:59         ` Paul Jackson
2004-03-20  3:18           ` William Lee Irwin III
2004-03-20  6:09             ` Paul Jackson
2004-03-20  9:36               ` William Lee Irwin III
2004-03-22 23:59                 ` Paul Jackson
2004-03-23  2:12                   ` William Lee Irwin III
2004-03-23  1:21                 ` Paul Jackson
2004-03-23  2:10                   ` William Lee Irwin III
2004-03-23  1:24                 ` Paul Jackson
2004-03-20  8:02             ` Paul Jackson
2004-03-20 11:13               ` William Lee Irwin III
2004-03-21  4:19                 ` Paul Jackson
2004-03-21  4:36                   ` William Lee Irwin III
2004-03-21  7:59                     ` Nick Piggin
2004-03-23  1:12                 ` Paul Jackson
2004-03-23  2:09                   ` William Lee Irwin III
2004-03-23  2:39                     ` Paul Jackson
2004-03-23  3:13                       ` William Lee Irwin III
2004-03-23  3:36                         ` Paul Jackson
2004-03-23  3:59                           ` William Lee Irwin III
2004-03-23  4:03                             ` Paul Jackson
     [not found]                             ` <20040325012457.51f708c7.pj@sgi.com>
     [not found]                               ` <20040325101827.GO791@holomorphy.com>
2004-03-26 22:36                                 ` Sparc64, cpumask_t and struct arguments (was: [PATCH] Introduce nodemask_t ADT) Paul Jackson
2004-03-26 22:54                                   ` David S. Miller
2004-03-26 23:18                                     ` Paul Jackson
2004-03-26 23:29                                     ` Paul Jackson
2004-03-27  0:08                                       ` David S. Miller
2004-03-27  0:50                                         ` Paul Jackson
2004-03-26 23:37                                     ` Paul Jackson
     [not found] <1BeOx-7ax-55@gated-at.bofh.it>
     [not found] ` <1BgGq-DU-5@gated-at.bofh.it>
     [not found]   ` <1BgZN-Vk-1@gated-at.bofh.it>
2004-03-19  2:04     ` [PATCH] Introduce nodemask_t ADT [0/7] Andi Kleen
2004-03-19  2:38       ` Paul Jackson
2004-03-19 23:09       ` Matthew Dobson
2004-03-20  0:47         ` Paul Jackson
2004-03-20  1:14           ` Paul Jackson

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=1079659184.8149.355.camel@arrakis \
    --to=colpatch@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=haveblue@us.ibm.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=pj@sgi.com \
    --cc=wli@holomorphy.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