Re: [PATCH 1/2] BDI: Provide backing device capability information

From: Andrew Morton
Date: Wed Mar 02 2005 - 23:43:46 EST


Linus Torvalds <torvalds@xxxxxxxx> wrote:
>
> On Wed, 2 Mar 2005, Andrew Morton wrote:
> >
> > Why not make these bitfields as well?
>
> Side note: bitfields aren't exactly wonderful.

Yup. In this application the fields are initialised once (usually at
compile time) and are never modified. So the compiler should be able to
generate the same code as it would with an open-coded bit test. Which is
about the only situation where we should use bitfields, IMO.

That being said, there aren't many backing_dev_info's in a system, so we
won't be saving much memory. Some architectures will presumably generate
faster code with plain old integers. You'd only ever lose if the
backing_dev_info happened to straddle a cacheline boundary. It's marginal.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/