Go to file
Arnaldo Carvalho de Melo 7401af38db [LIB]: Introduce class__has_hole_ge()
That returns if the class has a hole greater or equal to the size specified.

Pahole now has a --hole_size_ge command line option to use it.

Example on a linux kernel built for x86_64 where we list the structs that have
holes bigger than 32 bytes, that provides an approximation of structs with
____cacheline_aligned_in_smp annotated members:

[acme@filo pahole]$ pahole --hole_size_ge 32 examples/vmlinux-x86_64
inet_hashinfo
rcu_ctrlblk
hh_cache
net_device
files_struct
module
zone

For instance, look at struct zone clever use of such construct:

_pad1_ is defined with ZONE_PADDING(_pad1_), that is:

/* <40e> /home/acme/git/net-2.6.22/include/linux/mmzone.h:179 */
struct zone {
	long unsigned int          pages_min;            /*     0     8 */
	long unsigned int          pages_low;            /*     8     8 */
	long unsigned int          pages_high;           /*    16     8 */
	long unsigned int          lowmem_reserve[3];    /*    24    24 */
	int                        node;                 /*    48     4 */

	/* XXX 4 bytes hole, try to pack */

	long unsigned int          min_unmapped_pages;   /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	long unsigned int          min_slab_pages;       /*    64     8 */
	struct per_cpu_pageset *   pageset[255];         /*    72  2040 */
	/* --- cacheline 33 boundary (2112 bytes) --- */
	spinlock_t                 lock;                 /*  2112     4 */

	/* XXX 4 bytes hole, try to pack */

	struct free_area           free_area[11];        /*  2120   264 */

	/* XXX 48 bytes hole, try to pack */

	/* --- cacheline 38 boundary (2432 bytes) --- */
	struct zone_padding        _pad1_;               /*  2432     0 */
	spinlock_t                 lru_lock;             /*  2432     4 */

	/* XXX 4 bytes hole, try to pack */

	struct list_head           active_list;          /*  2440    16 */
	struct list_head           inactive_list;        /*  2456    16 */
	long unsigned int          nr_scan_active;       /*  2472     8 */
	long unsigned int          nr_scan_inactive;     /*  2480     8 */
	long unsigned int          pages_scanned;        /*  2488     8 */
	/* --- cacheline 39 boundary (2496 bytes) --- */
	int                        all_unreclaimable;    /*  2496     4 */
	atomic_t                   reclaim_in_progress;  /*  2500     4 */
	atomic_long_t              vm_stat[20];          /*  2504   160 */
	/* --- cacheline 41 boundary (2624 bytes) was 40 bytes ago --- */
	int                        prev_priority;        /*  2664     4 */

	/* XXX 20 bytes hole, try to pack */

	/* --- cacheline 42 boundary (2688 bytes) --- */
	struct zone_padding        _pad2_;               /*  2688     0 */
	wait_queue_head_t *        wait_table;           /*  2688     8 */
	long unsigned int          wait_table_hash_nr_entries; /*  2696     8 */
	long unsigned int          wait_table_bits;      /*  2704     8 */
	struct pglist_data *       zone_pgdat;           /*  2712     8 */
	long unsigned int          zone_start_pfn;       /*  2720     8 */
	long unsigned int          spanned_pages;        /*  2728     8 */
	long unsigned int          present_pages;        /*  2736     8 */
	const char  *              name;                 /*  2744     8 */
	/* --- cacheline 43 boundary (2752 bytes) --- */
}; /* size: 2752, cachelines: 43 */
   /* sum members: 2672, holes: 5, sum holes: 80 */
   /* definitions: 933 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-11 13:32:53 -03:00
cmake/modules [CMAKE] FindDWARF: Tell exactly which dependency was not found 2007-05-09 11:53:07 -03:00
lib [LIB]: Introduce conf_fprintf 2007-04-28 16:13:35 -03:00
ostra [CTRACER]: Lots of improvements 2007-02-02 15:15:27 -02:00
rpm/SPECS [RPM]: 24th release 2007-05-08 12:13:51 -03:00
CMakeLists.txt [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize 2007-05-07 00:30:02 -03:00
MANIFEST [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize 2007-05-07 00:30:02 -03:00
README [CMAKE]: Make the default install prefix be /usr/local 2007-04-19 18:01:47 -03:00
README.ctracer [CTRACER]: Lots of improvements 2007-02-02 15:15:27 -02:00
codiff.c [CODIFF]: Use cus__loadfl/libdwfl 2007-04-30 15:44:11 -03:00
ctracer.c [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize 2007-05-07 00:30:02 -03:00
dtagnames.c [LIB]: Allow of not specifying -e 2007-04-24 16:09:34 -03:00
dwarves.c [LIB]: Introduce class__has_hole_ge() 2007-05-11 13:32:53 -03:00
dwarves.h [LIB]: Introduce class__has_hole_ge() 2007-05-11 13:32:53 -03:00
dwarves_emit.c [LIB]: Move the __emit functions to a separate library, libdwarves_emit 2007-05-06 14:50:28 -03:00
dwarves_emit.h [LIB]: Move the __emit functions to a separate library, libdwarves_emit 2007-05-06 14:50:28 -03:00
dwarves_reorganize.c [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize 2007-05-07 00:30:02 -03:00
dwarves_reorganize.h [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize 2007-05-07 00:30:02 -03:00
list.h Repository creation. 2006-10-24 20:42:39 -03:00
pahole.c [LIB]: Introduce class__has_hole_ge() 2007-05-11 13:32:53 -03:00
pdwtags.c [LIB]: Introduce conf_fprintf 2007-04-28 16:13:35 -03:00
pfunct.c [LIB]: Introduce conf_fprintf 2007-04-28 16:13:35 -03:00
pglobal.c [LIB]: Introduce conf_fprintf 2007-04-28 16:13:35 -03:00
prefcnt.c [PREFCNT]: reference count functions 2007-04-28 17:19:50 -03:00

README

Build instructions:

1. install cmake
2. mkdir build
3. cd build
4. cmake -D__LIB=lib ..
5. make install

Default is to be installed on /usr/local, see rpm spec file for
installing on other places.

Known to work scenarios:

Mandriva Cooker:

cmake 2.4.5-1mdv2007.1
libelfutils1-devel 0.123-1mdv2007.1

Debian Unstable:

cmake 2.4.5-1
libdw-dev 0.123-2

Fedora Core 6:

cmake 2.4.5-2.fc6
elfutils-devel 0.126-1.fc6