Skip to content

CONFIG_LATENCYTOP=y has a huge size overhead for every task_struct and should be disabled

Description:

CONFIG_LATENCYTOP=y has a very large size overhead (3000 bytes) per task_struct. I noticed it when doing pahole -C task_struct and inspecting task_struct's layout; I noticed a very large member:

    int latency_record_count; /\* 2976 4 \*/
    /* XXX 4 bytes hole, try to pack */

    struct latency_record      latency_record[32];   /*  2984  3840 */
    /* --- cacheline 106 boundary (6784 bytes) was 40 bytes ago --- */

and a quick check tells us that this is gated by:

#ifdef CONFIG_LATENCYTOP
        int latency_record_count;
        struct latency_record latency_record[LT_SAVECOUNT];
#endif

I believe it should be disabled as it is around 40% of task_struct's memory footprint (so, per-process and per-kthread) and latencytop is not even part of the repos (just AUR, but it seems that it isn't used too much). Other distros such as Debian also do not enable this option.

I don't mind submitting an MR as long as everyone's ok with this change. Other kernel packages likely also need it.

Additional info:

  • package version(s): linux 6.7.1-arch1-1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information