2004-06-01 07:17:24

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch 2.6.7-rc2] Add const to some scheduling functions

Keith Owens <[email protected]> wrote:
>
> Several scheduler macros only read from the task struct, mark them
> const. It can generate better code.

It makes no change to the gcc-3.4.0-compiled x86 kernel's size. Under what
circumstances did you see improvements?


2004-06-01 09:55:35

by Keith Owens

[permalink] [raw]
Subject: Re: [patch 2.6.7-rc2] Add const to some scheduling functions

On Tue, 1 Jun 2004 00:16:32 -0700,
Andrew Morton <[email protected]> wrote:
>Keith Owens <[email protected]> wrote:
>>
>> Several scheduler macros only read from the task struct, mark them
>> const. It can generate better code.
>
>It makes no change to the gcc-3.4.0-compiled x86 kernel's size. Under what
>circumstances did you see improvements?

None, it is just good programming practice to mark parameters as const
where possible.

2004-06-01 20:15:42

by Paul Jackson

[permalink] [raw]
Subject: Re: [patch 2.6.7-rc2] Add const to some scheduling functions

Keith wrote (of some added 'const' qualifiers):
> It can generate better code.

Later, he wrote (when asked under what circumstances he saw this):
>None, it is just good programming practice ...

So you're not saying it _does_ generate better code, but that it's
possible that it could do so, right?

In any case, the value of 'const' to me is more in documenting
the interface, and imposing compiler checked restrictions on the
implementation.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373