linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Infrastructure for dynamic removal of code and data sections
@ 2010-12-21 18:19 Thomas Petazzoni
  2010-12-21 18:19 ` [PATCH 1/6] Add infrastructure for conditional " Thomas Petazzoni
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2010-12-21 18:19 UTC (permalink / raw)
  To: linux-omap

Hello,

Here is a patchset that proposes a mechanism to get rid at runtime of
unused data and code sections, depending on the SoC we are currently
running on.

WARNING: This is only a proof-of-concept, there are many known
issues. The sole purpose of this patch is to get some feedback on
whether the idea is useful or not, and whether it's worth cleaning up
the remaining issues.

It is for the moment presented on the linux-omap@ list only, as the
usage is only demonstrated on OMAP, but the core infrastructure is
mostly architecture-independent (except a modification in the
architecture-specific linker script).

A trend in the kernel support for SoC is to build a single kernel that
works accross a wide range of SoC inside a SoC family, or even in the
future SoC of different families.

While this is very interesting to reduce the number of kernel images
needed to support a large number of hardware platforms, it allows
means that the kernel image size is increasing. Portions of code and
data are specific to a given SoC (clock structures, hwmod structures
on OMAP, etc.) and only the portion relevant for the current SoC the
kernel is running on is actually useful. The rest of the code and data
remains in memory forever.

While __init and __initdata can solve some of those cases, it is not
necessarly easy to use, since the code/data that is actually useful
needs to be copied so that it is kept after the init memory cleanup.

Therefore, we introduce an infrastructure that allows to put code and
data into specific sections, called "conditional sections". All those
sections are compiled into the final kernel image, but at runtime, by
calling a function, we can get rid of the unused sections.

The first patch introduces the generic infrastructure. See the
description of this patch for details on how it is implemented.

The second patch introduces macros to mark code/data to be
OMAP2/3/4-specific.

The third, fourth and fith patches mark some clock and hwmod data as
being OMAP2, OMAP3 or OMAP4 specific. Unfortunately, I haven't found
a way of marking the strings inside the structures to be part of a
particular section, so the memory used for those strings is not
reclaimed.

The sixth patch modifies the BeagleBoard board code to call the
function that frees the OMAP2 and OMAP4 specific code and data.

At boot, what I have is:

Freeing unused conditional section: omap2 data 0xc09a9000 -> 0c09b2000 (sz=36864)
Freeing unused conditional section: omap4 data 0xc09ba000 -> 0c09c2000 (sz=32768)

Which means that 68 KB of memory has been freed. Obviously, I haven't
marked all code/data, so higher gains can be expected.

Regards,

Thomas


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-01-03  8:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 18:19 [RFC] Infrastructure for dynamic removal of code and data sections Thomas Petazzoni
2010-12-21 18:19 ` [PATCH 1/6] Add infrastructure for conditional " Thomas Petazzoni
2010-12-21 19:27   ` Tony Lindgren
2010-12-21 22:00     ` Thomas Petazzoni
2010-12-22 18:28       ` Tony Lindgren
2010-12-22 18:42         ` Thomas Petazzoni
2010-12-22 19:02           ` Tony Lindgren
2010-12-23 12:31         ` Aaro Koskinen
2010-12-23 12:44           ` Thomas Petazzoni
2010-12-23 18:02           ` Tony Lindgren
2011-01-03  3:37   ` Paul Walmsley
2011-01-03  8:08     ` Paul Walmsley
2010-12-21 18:20 ` [PATCH 2/6] omap: add macros to mark SoC-specific data/code Thomas Petazzoni
2010-12-21 18:20 ` [PATCH 4/6] omap3: mark some data as omap3-specific Thomas Petazzoni
2010-12-21 18:20 ` [PATCH 5/6] omap4: mark some data as omap4-specific Thomas Petazzoni
2010-12-21 18:20 ` [PATCH 6/6] omap3: beagle: get rid of unused omap2/omap4 specific code/data Thomas Petazzoni
2010-12-21 19:15   ` Menon, Nishanth
2010-12-21 21:57     ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).