From: Jeff Law <law@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Boyer <jwboyer@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] posix_types.h: make __NFDBITS compatible with glibc definition
Date: Tue, 24 Jul 2012 13:15:08 -0600 [thread overview]
Message-ID: <500EF43C.3060200@redhat.com> (raw)
In-Reply-To: <CA+55aFyn-yMUMdcY8jp65eeoGm3RPzy9p+St35-HGE_xXiVJag@mail.gmail.com>
On 07/24/12 13:09, Linus Torvalds wrote:
> On Tue, Jul 24, 2012 at 12:03 PM, Josh Boyer <jwboyer@redhat.com> wrote:
>>
>> FWIW, the definitions of __FD_ELT/__FD_MASK in glibc are:
>>
>> #define __FD_ELT(d) ((d) / __NFDBITS)
>> #define __FD_MASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS))
>>
>> where __fd_mask is 'typdef long int'.
>
> Yeah, that's not good.
>
> If __NFDBITS is signed (and it is), and "d" is a signed type, that
> division and modulus now create stupid extra code with conditionals
> (assuming 'd' isn't constant, of course).
>
> So changing the sign of __NFDBITS has these kinds of subtle side
> effects that clearly the glibc people didn't actually think about.
>
> What was the *advantage* of that stupidity?
>
> Quite frankly, if you want to make NFDBITS be an "int", then it should
> have been done at that
>
> #define NFDBITS ((int)__NFDBITS)
>
> level, not at "__NFDBITS". Exactly because the unsigned type there matters.
>
> Does anybody in the glibc camp care about efficient and small code AT ALL?
Please refer to the original discussion where they did evaluate the cost
of this change and tested that the final change made no difference to
the generated code.
http://sourceware.org/bugzilla/show_bug.cgi?id=14210
Needlessly slamming these folks doesn't help anything.
Jeff
next prev parent reply other threads:[~2012-07-24 19:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 18:12 [PATCH] posix_types.h: make __NFDBITS match glibc definition Josh Boyer
2012-07-24 18:20 ` Linus Torvalds
2012-07-24 18:24 ` Josh Boyer
2012-07-24 18:32 ` [PATCH v2] posix_types.h: make __NFDBITS compatible with " Josh Boyer
2012-07-24 18:46 ` Linus Torvalds
2012-07-24 19:03 ` Josh Boyer
2012-07-24 19:09 ` Linus Torvalds
2012-07-24 19:15 ` Jeff Law [this message]
2012-07-24 19:24 ` Linus Torvalds
2012-07-24 19:26 ` Jeff Law
2012-07-24 19:43 ` Josh Boyer
2012-07-24 19:55 ` Linus Torvalds
2012-07-24 20:10 ` Josh Boyer
2012-07-24 20:13 ` Linus Torvalds
2012-07-24 20:02 ` Andreas Schwab
2012-07-24 19:43 ` Linus Torvalds
2012-07-24 20:01 ` Jeff Law
2012-07-24 19:19 ` [PATCH] posix_types.h: make __NFDBITS match " Jeff Law
2012-07-24 19:37 ` Linus Torvalds
2012-07-24 19:39 ` Linus Torvalds
2012-07-24 19:41 ` Josh Boyer
2012-07-24 19:59 ` Linus Torvalds
2012-07-24 20:11 ` Linus Torvalds
2012-07-24 20:52 ` Andreas Schwab
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=500EF43C.3060200@redhat.com \
--to=law@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jwboyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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).