Re: complicated identifier sequence

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

 



On Wed, Sep 08, 2010 at 11:45:16AM -0700, Alison Chaiken wrote:
> Josh Cartwright <joshc@xxxxxxxxx> wrote:
> > __devinitdata is a preprocessor macro that will place the storage of the
> > supported device PCI ID table in a specific section for special
> > treatment.
> 
> Thanks, that's *precisely* what I wanted to know.   I will print your
> answer out and stick it in the textbook.   I see that the example is
> confusing because it's essentially a reference to the kernel ABI, not
> the API.

Glad I could help.

> As a general rule, I infer that when C looks peculiar and I can't
> figure out what's going on from include/linux/*.h, I should consider l
> looking at GCC docs instead.

Its easy when you are new to the kernel to be overwhelmed by the
boilerplate.  I feel for you :).

> This related question
> 
> http://lkml.indiana.edu/hypermail/linux/kernel/0912.0/02339.html
> 
> is interesting although it looks like no one answered.

Well, I'm not sure exactly how these particular mechanisms work, but I
can describe their intent, and I'll leave the
understanding-the-implementation part as an exercise for you :).

The __devinit and __devinitdata attributes put device initialization
code and data in special sections which enable the kernel to make
some memory-usage optimizations by controlling the lifetime of these
sections in memory.

If a kernel is built with hotplugging disabled, then all device
initialization can be done one time, during boot, at which point the
kernel can free up memory by freeing those pages holding the device
initializing code and data.

Like you were seeing before, when the kernel supports hotplugging
(CONFIG_HOTPLUG is defined), then the kernel can't make the optimizing
assumption that device initialization only happens at boot time, so
nothing is gained by placing device initializing code and data into
separate sections.

I'm sure I missed some details, but the kernel source is all there to
fill in the gaps :)


-- 
                                -joshc

--
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