mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: joe.korty@ccur.com, akpm@osdl.org, paulus@samba.org,
	linux-kernel@vger.kernel.org
Subject: Re: seperator error in __mask_snprintf_len
Date: Fri, 16 Jan 2004 15:29:48 -0800	[thread overview]
Message-ID: <400873EC.2000406@us.ibm.com> (raw)
In-Reply-To: <20040115161732.458159f5.pj@sgi.com>

FWIW, I think a 32-bit chunk-size is preferable.  I personally don't 
think "dead,beef" is easier to read than "deadbeef", nor "0073,0f0f" 
compared to "00730f0f".  On the small CPU count, ie: <=32, either 
version is pretty readable, but on larger CPU count boxen you're going 
to overflow your brain counting groups of 4 versus groups of 8.  I can't 
believe I just called a 32 CPU box "small".  My world perspective is a 
bit skewed... ;)

Also, on the input side, a lot of apps will output a 32-bit CPU mask. 
With commas separating every 32 bits, we can feed an "uncommafied" mask 
to the kernel and it won't barf.  If we go with 16-bit chunks, we'll 
have to "commafy" these 32-bit bitmasks to feed them to the kernel.

As a NUMA guy who deals with largish CPU count machines daily, that's my 
2 cents...

-Matt


Paul Jackson wrote:
>>This patch captures what I am looking for in bitmap display and input.
> 
> 
> Interesting.  I appear to have provoked Joe into a burst of coding.
> Now, if I had any smarts, I would stand aside and let Joe own this,
> just as Bill Irwin did when I posted my initial lib/mask.c patch a
> couple months ago.
> 
> 
> Andrew:
> 
>     If you find Joe's coding more to your liking than my "Gad" style,
>     I will bless this, and after tossing in a few parting shots, will
>     stand aside.  It meets my essential needs, which were:
>      - chunked output (a comma every 16 or 32 bits),
>      - symmetric input and output formats, and
>      - display and parsing code generic to diverse bitmap sizes.
> 
>     My actual recommendation, if however you are still undecided, is:
>      - my patch of last night (with the M32X() 64 bit big endian fix),
>      - Joe's recommended format, zero-filling to chunksize each word,
>      - Joe's renaming/refactoring from lib/mask.c to lib/bitmap.h, and
>      - a chunksize of 16 rather than 32 (Joe likes 16, I don't care).
> 
> The essential differences between Joe's and my proposals that I see are:
>     - Joe's has more code, especially in the parsing routine,
>     - Joe's bitmap size resolution is bits, not words, and
>     - I use an implied alloca of 4 x sizeof(mask) bytes.
> 
> 
> Comments on Joe's patch:
> 
> 
>>ChangeLog:
> 
> 
>   Good job of summarizing for the Changelog the changes.
> 
> 
>>o move into the bitmap.h family, rename and refactor interface to match
> 
> 
>   I think I like this - good.
> 
> 
>> o bitmap size resolution changed from byte to bit
> 
> 
>   Why?  This adds a fair bit of complexity to the code, I suspect.
>   I am not aware of a need for this, but if there is one, ok.
> 
> 
>>o chunking (digits between commas) changed from 8 to 4 digits
> 
> 
>   Ok - either 8 or 4 works for me.  This detail should be decided
>   by those working on 16 to 32 cpu systems, who will notice this
>   choice the most.  Those of us on larger or smaller systems are
>   going to see, or not see, separators in either case.
> 
> 
>> o display no longer affected by sizeof(unsigned long).
> 
> 
>   A bit of a misstatement.  The display was only affected by the
>   chunksize, one of 32 (sizeof(u32)*8) or 16 (CHUNKSZ).
> 
> 
>> o no alloca usage
> 
> 
>   True.  Though on the other hand, you need to roll your own parsing
>   code of comma-separated chunks, instead of getting by with using
>   strsep().  So you trade alloca usage for code complexity.  Either
>   way works - coders choice.  I agree that we disagree on this tradeoff.
> 
> 
>> o works correctly independent of the size of an unsigned long.
> 
> 
>   And my version doesn't?
> 
> 
>> o works on big and little endian machine.
> 
> 
>   With my M32X() eor-1 fix, so did mine.
> 
> 
>>+ * lib/bitmask.c - bitmask manipulation routines too big to go into bitmask.h
> 
> 
>   Typo?  Did you mean bitmap.c and bitmap.h, not bitmask?
> 
> 
>>+int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
>>+        unsigned long *maskp, unsigned int nmaskbits)
> 
> 
>   This routine has quite a bit more code detail than my corresponding
>   parsing routine.  I hope that:
>     (1) providing bit-level resolution, and
>     (2) removing the implied alloca
>   justifies this increase in code detail.
> 
> 
>>+			if (isspace(c))
>>+				continue;
> 
> 
>   So a space embedded in a hex number is skipped?  That is, your code
>   parses "dead,beef" and "de a d, bee  f" the same?  This seems strange.
>   Perhaps you would prefer to suppress only leading spaces in each chunk:
> 
> 			if (!n && isspace(c))
> 				continue;
> 
> 
>>+			for (j = 0; j < 32; j++) {
> 
> 
>   What's this "32", an unrepentant CHUNKSZ?
> 



  parent reply	other threads:[~2004-01-16 23:36 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 16:56 Joe Korty
2004-01-07 19:32 ` Andrew Morton
2004-01-08 13:11   ` Paul Jackson
2004-01-08 22:50     ` Paul Mackerras
2004-01-08 22:59       ` Joe Korty
2004-01-09  0:07         ` Paul Mackerras
2004-01-09  1:11           ` Paul Jackson
2004-01-14 23:03           ` Paul Jackson
2004-01-15  0:27             ` Joe Korty
2004-01-15  0:37               ` Paul Jackson
2004-01-15  4:40               ` Paul Jackson
2004-01-15 16:15                 ` Andrew Morton
2004-01-15 18:15                   ` Joe Korty
2004-01-16  0:17                     ` Paul Jackson
2004-01-16  0:48                       ` Joe Korty
2004-01-16  1:48                         ` Paul Jackson
2004-01-16 23:29                       ` Matthew Dobson [this message]
2004-01-17  6:36                         ` [PATCH] bitmap parsing routines, version 3 Joe Korty
2004-01-17 10:08                           ` Paul Jackson
     [not found]                             ` <20040117145545.GA16318@tsunami.ccur.com>
2004-01-17 15:36                               ` Joe Korty
2004-01-17 23:33                                 ` Paul Jackson
2004-01-18  5:52                                   ` William Lee Irwin III
2004-01-18  7:03                                     ` Paul Jackson
2004-01-17 18:39                           ` [PATCH] bitmap parsing/printing routines, version 4 Joe Korty
2004-01-17 23:36                             ` Paul Jackson
2004-01-19 21:17                             ` Matthew Dobson
2004-01-20  0:17                               ` Paul Jackson
2004-01-20  3:57                               ` Joe Korty
2004-01-20  4:15                                 ` Paul Jackson
2004-01-20  5:41                                 ` Randy Dunlap
2004-01-20  7:03                                 ` Matthew Dobson
2004-01-20 15:36                                   ` Joe Korty
2004-01-20 17:06                                     ` Matthew Dobson
2004-01-17  9:12                         ` seperator error in __mask_snprintf_len Paul Jackson
2004-01-16  5:14                     ` Paul Jackson
2004-01-16  5:26                       ` Andrew Morton
2004-01-16  5:52                         ` William Lee Irwin III
2004-01-16 14:23                       ` Joe Korty
2004-01-17 10:07                         ` Paul Jackson
2004-01-15 22:53                   ` Paul Jackson
2004-01-16  1:06                     ` Andrew Morton
2004-01-16  2:54                       ` Paul Jackson
2004-01-09 14:28         ` Paul Jackson
2004-01-09 14:46       ` Paul Jackson
2004-01-09 15:14         ` Andreas Schwab
2004-01-09 15:25           ` Christoph Hellwig
2004-01-09 17:23             ` Paul Jackson
2004-01-12  0:09               ` Joe Korty
2004-01-12 21:41                 ` Paul Jackson
2004-01-12 22:00                   ` Joe Korty
2004-01-12 22:28                     ` Paul Jackson
2004-01-12 22:39                       ` Joe Korty
2004-01-09 14:57       ` Paul Jackson
2004-01-08  1:06 ` Paul Jackson
2004-01-08  3:32   ` Joe Korty
2004-01-08 10:39     ` Paul Jackson
     [not found] <1bpdu-5jP-35@gated-at.bofh.it>
     [not found] ` <1brIi-Y0-57@gated-at.bofh.it>
     [not found]   ` <1bIf6-fh-21@gated-at.bofh.it>
     [not found]     ` <1bRiA-4PD-19@gated-at.bofh.it>
     [not found]       ` <1bRrZ-58C-9@gated-at.bofh.it>
     [not found]         ` <1bSHD-Xz-21@gated-at.bofh.it>
     [not found]           ` <1e2sZ-rG-19@gated-at.bofh.it>
     [not found]             ` <1e3Ih-1V0-1@gated-at.bofh.it>
     [not found]               ` <1e7Cd-4qD-5@gated-at.bofh.it>
     [not found]                 ` <1einZ-64E-11@gated-at.bofh.it>
     [not found]                   ` <1ekpM-87C-1@gated-at.bofh.it>
     [not found]                     ` <1euyS-Eb-19@gated-at.bofh.it>
     [not found]                       ` <1euSb-U8-3@gated-at.bofh.it>
2004-01-16  8:25                         ` Andi Kleen
2004-01-16  8:35                           ` Andrew Morton
2004-01-16 10:16                             ` Andi Kleen

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=400873EC.2000406@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=pj@sgi.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

Powered by JetHome