Development/Pahole

From bwHPC Wiki
< Development
Revision as of 18:10, 4 November 2020 by R Keller (talk | contribs)
Jump to navigation Jump to search
Description Content
module load devel/pahole
Availability bwUniCluster
License GPL
Citing n/a
Links Homepage | Releases
Graphical Interface No
Included modules


Introduction

The Dwarves Tools is a tool-set to dissect user- and kernel level data structures and performance analysis using tracers.

Versions and Availability

A list of versions currently available on all bwHPC Clusters can be obtained from the

Cluster Information System CIS

{{#widget:Iframe |url=https://cis-hpc.uni-konstanz.de/prod.cis/bwUniCluster/devel/pahole |width=99% |height=120 }}


Documentation

There currently is no web documentation, or tutorial. For local documentation consult the man page.

$ man pahole



Basic commands

You may receive information on the padding and alignment of data structures using pahole. If interested in the data layout pass the option to expand data structures, e.g. the kernel's data structure for every single task, use pahole -E task_struct

struct task_struct {
  struct thread_info {
    long unsigned int  flags;         /*     0     8 */
    unsigned int       status;        /*     8     4 */
  } thread_info;                      /*     0    16 */

  /* XXX last struct has 4 bytes of padding */

  volatile long int    state;         /*    16     8 */
  void *   stack;                     /*    24     8 */
  struct {
    int    counter;                   /*    32     4 */
  } usage;                            /*    32     4 */
  unsigned int         flags;         /*    36     4 */
  unsigned int         ptrace;        /*    40     4 */

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

  struct llist_node {
    struct llist_node * next;         /*    48     8 */
  } wake_entry;                       /*    48     8 */
  int      on_cpu;                    /*    56     4 */
  unsigned int         cpu;           /*    60     4 */
  /* --- cacheline 1 boundary (64 bytes) --- */
  unsigned int         wakee_flips;   /*    64     4 */
  ...
}

This nicely shows, where the compiler needed to insert padding to adhere to the architecture's alignment requirements specified by the ABI. Additionally it layouts the crossing of past cacheline boundaries, which might be problematic in false sharing of cachelines in multi-threaded programming. Both of this information may be used by You to re-layout your data-structures to minimize them and limit cache-thrashing.