linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com
Subject: Bloat caused by unnecessary calls to compound_head()?
Date: Sat, 26 Mar 2016 13:50:49 -0500	[thread overview]
Message-ID: <20160326185049.GA4257@zzz> (raw)

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>

             reply	other threads:[~2016-03-26 18:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26 18:50 Eric Biggers [this message]
2016-03-27 19:46 ` Bloat caused by unnecessary calls to compound_head()? Kirill A. Shutemov
2016-03-27 19:47   ` [PATCH 1/4] page-flags: generate page-flags helpers with script Kirill A. Shutemov
2016-03-27 19:47     ` [PATCH 2/4] mm: introduce struct head_page and compound_head_t Kirill A. Shutemov
2016-03-27 19:47     ` [PATCH 3/4] page-flags: make page flag helpers accept struct head_page Kirill A. Shutemov
2016-03-27 19:47     ` [PATCH 4/4] mm: convert make_page_accessed to use compount_page_t() Kirill A. Shutemov
2016-04-01  1:33   ` Bloat caused by unnecessary calls to compound_head()? Eric Biggers
2016-04-04 10:39     ` Kirill A. Shutemov
  -- strict thread matches above, loose matches on Subject: below --
2016-03-27 20:33 George Spelvin
2016-03-27 20:44 ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160326185049.GA4257@zzz \
    --to=ebiggers3@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).