linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/7] mm: Store compound_nr as well as compound_order
Date: Tue, 11 Aug 2020 23:53:41 +0100	[thread overview]
Message-ID: <20200811225341.GZ17456@casper.infradead.org> (raw)
In-Reply-To: <20200706102925.ot3vgdg5mnr5d4gh@box>

On Mon, Jul 06, 2020 at 01:29:25PM +0300, Kirill A. Shutemov wrote:
> On Mon, Jun 29, 2020 at 04:19:53PM +0100, Matthew Wilcox (Oracle) wrote:
> > This removes a few instructions from functions which need to know how many
> > pages are in a compound page.  The storage used is either page->mapping
> > on 64-bit or page->index on 32-bit.  Both of these are fine to overlay
> > on tail pages.
> 
> I'm not a fan of redundant data in struct page, even if it's less busy
> tail page. We tend to find more use of the space over time.
> 
> Any numbers on what it gives for typical kernel? Does it really worth it?

Oops, I overlooked this email.  Sorry.  Thanks to Andrew for the reminder.

I haven't analysed the performance win for this.  The assembly is
two instructions (11 bytes) shorter:

before:
    206c:       a9 00 00 01 00          test   $0x10000,%eax
    2071:       0f 84 af 02 00 00       je     2326 <shmem_add_to_page_cache.isra.0+0x3b6>
    2077:       41 0f b6 4c 24 51       movzbl 0x51(%r12),%ecx
    207d:       41 bd 01 00 00 00       mov    $0x1,%r13d
    2083:       49 8b 44 24 08          mov    0x8(%r12),%rax
    2088:       49 d3 e5                shl    %cl,%r13
    208b:       a8 01                   test   $0x1,%al

after:
    2691:       a9 00 00 01 00          test   $0x10000,%eax
    2696:       0f 84 95 01 00 00       je     2831 <shmem_add_to_page_cache.isr
a.0+0x291>
    269c:       49 8b 47 08             mov    0x8(%r15),%rax
    26a0:       45 8b 77 58             mov    0x58(%r15),%r14d
    26a4:       a8 01                   test   $0x1,%al

(there are other changes in these files, so the addresses aren't
meaningful).

If we need the space, we can always revert this patch.  It's all hidden
behind the macro anyway.

  reply	other threads:[~2020-08-11 22:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 15:19 [PATCH 0/7] THP prep patches Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/7] mm: Store compound_nr as well as compound_order Matthew Wilcox (Oracle)
2020-06-29 16:22   ` Ira Weiny
2020-06-29 16:24     ` Matthew Wilcox
2020-07-06 10:29   ` Kirill A. Shutemov
2020-08-11 22:53     ` Matthew Wilcox [this message]
2020-06-29 15:19 ` [PATCH 2/7] mm: Move page-flags include to top of file Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 3/7] mm: Add thp_order Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 4/7] mm: Add thp_size Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 5/7] mm: Replace hpage_nr_pages with thp_nr_pages Matthew Wilcox (Oracle)
2020-06-29 17:40   ` Mike Kravetz
2020-06-29 18:14     ` Matthew Wilcox
2020-06-29 18:32       ` Matthew Wilcox
2020-07-01  1:33         ` Andrew Morton
2020-06-29 15:19 ` [PATCH 6/7] mm: Add thp_head Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 7/7] mm: Introduce offset_in_thp Matthew Wilcox (Oracle)
2020-06-29 17:11 ` [PATCH 0/7] THP prep patches William Kucharski
2020-06-29 18:13 ` Zi Yan

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=20200811225341.GZ17456@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=kirill@shutemov.name \
    --cc=linux-fsdevel@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).