Re: __initdata query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 14 Mar 2008, Davide Madrisan wrote:

> > are you sure about the above?  can you point at a sample source file
> > somewhere in the kernel tree that allows __initdata to be applied to
> > module parameters?  i've just never seen that.  maybe i haven't looked
> > hard enough.
>
> I've found a few examples (linux 2.6.23):
>
> drivers/char/agp/amd64-agp.c
> drivers/char/hw_random/intel-rng.c
> drivers/char/watchdog/sa1100_wdt.c
> drivers/s390/block/xpram.c
> drivers/scsi/gdth.c
> drivers/video/vfb.c
>
> and
>
> sound/oss/ad1848.c
> sound/oss/aedsp16.c
> sound/oss/msnd_pinnacle.c
> sound/oss/pas2_card.c
> sound/oss/pss.c
> sound/oss/sb_card.c
> sound/oss/sscape.c
> sound/oss/trix.c
> sound/oss/uart6850.c
> sound/oss/waveartist.c

ah, i think i *might* see what's going on.  ignore all the "oss"
stuff, it's going away soon, anyway.  consider
drivers/char/agp/amd64-agp.c:
  ...
  static int __initdata agp_try_unsupported = 1;
  ...
  module_param(agp_try_unsupported, bool, 0);
  ...

note the /sys filesystem perms for this parameter: 0 -- this means it
will *not* show up under /sys and, if it doesn't, then it really has
no value after loading.  therefore, it can be tossed.  (that's my
theory, which is mine.  ahem.)

let's try the next one -- drivers/char/hw_random/intel-rng.c:
  ...
  static __initdata int no_fwh_detect;
  module_param(no_fwh_detect, int, 0);
  ...

i see a pattern here.  one more, just for fun --
drivers/watchdog/sa1100_wdt.c:
  ...
  static int margin __initdata = 60;
  ...
  module_param(margin, int, 0);
  ...

yes, i think we've established what's happening.  as long as a module
parameter is defined with access rights of zero, it can be tagged as
__initdata.

would anyone like to confirm or deny that?  if it's true, it does
suggest that any module param with perms of zero *should* be tagged
with __initdata, to save space, since there's no reason to hang onto
it after loading.  but i'll wait for someone much smarter than me to
confirm all this.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux