Re: [PATCH 0/1] Constify struct address_space_operations for2.6.32-git-053fe57ac v2

From: Arjan van de Ven
Date: Mon Dec 14 2009 - 10:58:36 EST


On Mon, 14 Dec 2009 12:26:56 +0100
Pavel Machek <pavel@xxxxxx> wrote:

> > > Until such a consensus is reached one way or the other, please
> > > refrain from sending hundreds of patches -- one or two are
> > > sufficient for showing what you want to do until folks are on
> > > board with it, as is the typical nature of mechanical changes.
> >
> > I think there is consensus to constify ops variables as much as
> > possible (e.g., Alexey's similar patches).
>
> No such consensus exists. It is very clear from the patch reactions.

I for one am not opposed to using const where we could be using const.
It's a fundamental language feature, that helps the compiler and
developer. Yes there is sparse, and no, almost nobody uses that.

If it's const, it won't be and can't be changed, allowing
more aggressive optimization. It also means all these structures get
put in the rodata section, which means by definition they can no longer
have false sharing with data structures that are written to,.. and that
section is often even really read only (cpu protection bits), which is
also a nice, but secundary; _ops are one of those targets for rootkits
and accidental overwrites.

Rodata is also something that in theory we can replicate between numa
nodes (we don't do that yet I think, but it's one of those
chicken-and-egg things.. once rodata contains enough hot/critical
structures it becomes worth it)

Now, a 300 patch series to lkml is not the way to do this.
First step is to make checkpatch.pl warn about new cases.
Second step should be to convert all definitions, but using the "one
patch per maintainer" rule, not "one patch per file" rule. Yes it's
somewhat janitorial, but no it's not a big deal as long as it's not 300
patches to lkml. And it is much better than whitespace changes; it's
a real quality improvement to the kernel (in terms of code generation
and API)

Once everything is converted after a kernel release or two, you can
consider the third step of changing the actual prototypes/definitions,
which at that point is a small one-liner that isn't a big deal.



--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
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/