← [Back to Twitter thread index](../README.md) --- title: "Working on the Linux thread priority code. Linux doesn't allow sched_attr.size t" author: "NOTimothyLottes" handle: "@NOTimothyLottes" post_url: "https://x.com/NOTimothyLottes/status/2071937360288235902" post_id: "2071937360288235902" timestamp: "2026-06-30 12:42:16" post_count: 3 reply_count: 1 repost_count: 0 like_count: 10 view_count: 1212 --- # @NOTimothyLottes — Working on the Linux thread priority code. Linux doesn't allow sched_attr.size t ## Post 1 (2026-06-30 12:42:16) Working on the Linux thread priority code. Linux doesn't allow sched_attr.size to be minimized to just what is required for the scheduling mode (my prior bug). So I statically allocate the structures already filled in and cacheline aligned ... ![Media 1](./media/2071937360288235902_1.png) ## Post 2 (2026-06-30 12:45:15) — reply to Post 1 Theory says: better for size, worse for perf! Global structure will miss the cache. The alternative is to allow the code to generate the structure on the stack, which is likely in cache, and burn a few more cachelines of code (which gets linear prefetch). ## Post 3 (2026-06-30 12:47:30) — reply to Post 2 Clearly the default linux won't allow my non-blessed user to get SCHED_FIFO, and it also seems like my nice(-20) SCHED_OTHER backup is also not allowed either. Damn. More stuff to workaround. ![Media 1](./media/2071938677584863448_1.png)