mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bert Wesarg" <bert.wesarg@googlemail.com>
To: "Mike Travis" <travis@sgi.com>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, "Paul Jackson" <pj@sgi.com>
Subject: Re: [PATCH 2/2] x86: modify show_shared_cpu_map in intel_cacheinfo
Date: Mon, 31 Mar 2008 19:24:40 +0200	[thread overview]
Message-ID: <36ca99e90803311024h6aeb89beyd72f73c3763c0a9c@mail.gmail.com> (raw)
In-Reply-To: <47F112BD.4050801@sgi.com>

On Mon, Mar 31, 2008 at 6:35 PM, Mike Travis <travis@sgi.com> wrote:
> Bert Wesarg wrote:
>  > On Fri, Mar 28, 2008 at 7:19 PM, Mike Travis <travis@sgi.com> wrote:
>  >>  > Aren't the most cpumaps (like cpu/cpu*/topology/*_siblings or
>  >>  > node/node*/cpumap) bitmasks?
>  >>
>  >>  I did an informal survey and you are right, the majority of references do use
>  >>  cpumask_scnprintf instead of cpulist_scnprintf.  Maybe the later function was
>  >>  added later?
>  >>
>  >>  To me though, it would seem that:
>  >>
>  >>  240-255
>  >>
>  >>  is more readable than:
>  >>
>  >>  00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000ffff
>  >>
>  >>  And as I mentioned, bitmask_parselist() [libbitmask(3)] does parse the output.
>  > But libbitmask has a bitmask_parsehex() too. (but thanks for the
>  > pointer to this code).
>  >
>  > Anyway, your above example is wrong, the most significant bits comes first:
>  >
>  > ffff0000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
>  >
>  > This makes it not more readable, but I think readability isn't in this
>  > case of that much importance.
>
>  The original problem was how to avoid allocating a large stack space to display
>  cpu ids.  By using cpulist_scnprintf, it accomplishes this without, what I think
>  is too much pain.  If it's really that much of a problem, I will rework this patch.
>  But the length of the line with 4096 cpus will be 1152 bytes  Is this really
>  better?
I ask myself, why is there a temporary buffer allocation in the first
place? In the end it is copied unbounded into the provided buf
argument. Sure your list is mostly shorter than a hex mask, but you
can also not be sure that it fit into the provided buffer. So you can
also use cpumask_scnprintf directly with the buf argument, and provide
a good known upper bound for the size (ie.
cpumask_scnprintf_len(nr_cpu_ids)).

>
>
>  >
>  > I further think, this problem could be easily solved, if NR_CPUS and
>  > possibly your nr_cpus_ids is somehow exported to user space.
>  >
>  > With this information, the user is not surprised to see more that 1024
>  > bits (=CPU_SETSIZE, which is currently the glibc constant for the
>  > sched_{set,get}affinity() API). Also the glibc has the new variable
>  > cpu_set_t size API (since 2.7).
>
>  Yes, thanks.  That is being dealt with in another task.
Can you keep me up to date. Thanks.

Bert
>
>  Thanks,
>  Mike
>

  reply	other threads:[~2008-03-31 17:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 23:16 [PATCH 0/2] x86: add functions in preparation of cpumask changes Mike Travis
2008-03-27 23:16 ` [PATCH 1/2] x86: Convert cpumask_of_cpu macro to allocated array Mike Travis
2008-03-27 23:16 ` [PATCH 2/2] x86: modify show_shared_cpu_map in intel_cacheinfo Mike Travis
2008-03-28  9:01   ` Bert Wesarg
2008-03-28 14:40     ` Mike Travis
2008-03-28 14:54       ` Bert Wesarg
2008-03-28 18:19         ` Mike Travis
2008-03-29  8:59           ` Bert Wesarg
2008-03-31 16:35             ` Mike Travis
2008-03-31 17:24               ` Bert Wesarg [this message]
2008-03-31 18:18                 ` Paul Jackson
2008-03-31 17:56               ` 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=36ca99e90803311024h6aeb89beyd72f73c3763c0a9c@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pj@sgi.com \
    --cc=travis@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

all inboxes | Powered by JetHome®