[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121023063430.GB7020@moon>
Date: Tue, 23 Oct 2012 10:34:30 +0400
From: Cyrill Gorcunov <gorcunov@...nvz.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Pavel Emelyanov <xemul@...allels.com>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [rfc 0/2] Introducing VmFlags field into smaps output
On Mon, Oct 22, 2012 at 11:30:25PM -0700, Andrew Morton wrote:
...
> > Yup, but not only that, this kind of trick hides associativity between
> > VM_ constant and mnemonic, so on changes one would have to figure out
> > which position some flag has in this foo[] array, so I vote for not
> > use it :-)
>
> Well you could do
>
> struct {
> char x[2];
> } y[] = {
> [CLOG2(VM_DONTEXPAND)] = { 'd', 'e' },
> [CLOG2(VM_ACCOUNT)] = { 'a', 'c' },
> [CLOG2(VM_NORESERVE)] = { 'n', 'r' },
> };
>
> ...
>
> for (i = 0; i < BITS_PER_LONG; i++) {
> if (flags & (1 << i))
> seq_printf("%c%c ", y[i][0], y[i][1]);
> }
>
> where CLOG2() is extracted from the guts of ilog2().
>
> I'll stop now :)
Yup, this one will be a wy better. Letme try it out :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists