linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: Bloat caused by unnecessary calls to compound_head()?
@ 2016-03-27 20:33 George Spelvin
  2016-03-27 20:44 ` Kirill A. Shutemov
  0 siblings, 1 reply; 6+ messages in thread
From: George Spelvin @ 2016-03-27 20:33 UTC (permalink / raw)
  To: ebiggers3; +Cc: kirill, linux, linux-kernel, linux-mm

Could you just mark compound_head __pure?  That would tell the compiler
that it's safe to re-use the return value as long as there is no memory
mutation in between.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Bloat caused by unnecessary calls to compound_head()?
@ 2016-03-26 18:50 Eric Biggers
  2016-03-27 19:46 ` Kirill A. Shutemov
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2016-03-26 18:50 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, kirill.shutemov

Hi,

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?

Eric

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-04 10:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-27 20:33 Bloat caused by unnecessary calls to compound_head()? George Spelvin
2016-03-27 20:44 ` Kirill A. Shutemov
  -- strict thread matches above, loose matches on Subject: below --
2016-03-26 18:50 Eric Biggers
2016-03-27 19:46 ` Kirill A. Shutemov
2016-04-01  1:33   ` Eric Biggers
2016-04-04 10:39     ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).