Bloat caused by unnecessary calls to compound_head()?
From: Eric Biggers
Date: Sat Mar 26 2016 - 14:51:00 EST
I noticed that after the recent "page-flags" patchset, there are an excessive
number of calls to compound_head() in certain places.
For example, the frequently executed mark_page_accessed() function already
starts out by calling compound_head(), but then each time it tests a page flag
afterwards, there is an extra, seemingly unnecessary, call to compound_head().
This causes a series of instructions like the following to appear no fewer than
10 times throughout the function:
ffffffff81119db4: 48 8b 53 20 mov 0x20(%rbx),%rdx
ffffffff81119db8: 48 8d 42 ff lea -0x1(%rdx),%rax
ffffffff81119dbc: 83 e2 01 and $0x1,%edx
ffffffff81119dbf: 48 0f 44 c3 cmove %rbx,%rax
ffffffff81119dc3: 48 8b 00 mov (%rax),%rax
Part of the problem, I suppose, is that the compiler doesn't know that the pages
can't be linked more than one level deep.
Is this a known tradeoff, and have any possible solutions been considered?