All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	linux-mm@vger.kernel.org, Netdev <netdev@vger.kernel.org>,
	Matthew Wilcox <mawilcox@microsoft.com>
Subject: Re: [RFC 2/2] page_frag_cache: Store metadata in struct page
Date: Thu, 15 Mar 2018 14:26:28 -0700	[thread overview]
Message-ID: <CAKgT0Uf0qWbo7T8j00Owt_hEj6vZSY-MOsqUeZCek1x62DKz4Q@mail.gmail.com> (raw)
In-Reply-To: <20180315195329.7787-3-willy@infradead.org>

On Thu, Mar 15, 2018 at 12:53 PM, Matthew Wilcox <willy@infradead.org> wrote:
> From: Matthew Wilcox <mawilcox@microsoft.com>
>
> Shrink page_frag_cache from 24 to 8 bytes (a single pointer to the
> currently-in-use struct page) by using the page's refcount directly
> (instead of maintaining a bias) and storing our current progress through
> the page in the same bits currently used for page->index.  We no longer
> need to reflect the page pfmemalloc state if we're storing the page
> directly.
>
> On the downside, we now call page_address() on every allocation, and we
> do an atomic_inc() rather than a non-atomic decrement, but we should
> touch the same number of cachelines and there is far less code (and
> the code is less complex).
>
> Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>

So my concern with this patch is that it is essentially trading off
CPU performance for reduced size. One of the reasons for getting away
from using the page pointer is because it is expensive to access the
page when the ref_count is bouncing on multiple cache lines. In
addition converting from a page to a virtual address is actually more
expensive then you would think it should be. I went through and
optimized that the best I could, but there is still a pretty
significant cost to the call.

I won't be able to test the patches until next week, but I expect I
will probably see a noticeable regression when performing a small
packet routing test.

- Alex

  parent reply	other threads:[~2018-03-15 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 19:53 [RFC 0/2] Shrink page_frag_cache Matthew Wilcox
2018-03-15 19:53 ` [RFC 1/2] mm: Use page->mapping to indicate pfmemalloc Matthew Wilcox
2018-03-15 19:53 ` [RFC 2/2] page_frag_cache: Store metadata in struct page Matthew Wilcox
2018-03-15 21:03   ` Eric Dumazet
2018-03-15 21:26   ` Alexander Duyck [this message]
2018-03-16 21:05     ` Matthew Wilcox
2018-03-16 21:32       ` Eric Dumazet
2018-03-19  8:27       ` Jesper Dangaard Brouer
2018-03-17 20:54     ` David Miller
2018-03-17  2:17   ` [page_frag_cache] 47b0eaa4b5: BUG:unable_to_handle_kernel kernel test robot
2018-03-17  2:17     ` kernel test robot
2018-03-20 20:47   ` [RFC 2/2] page_frag_cache: Store metadata in struct page Alexander Duyck
2018-03-15 20:02 ` [RFC 0/2] Shrink page_frag_cache Alexander Duyck

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=CAKgT0Uf0qWbo7T8j00Owt_hEj6vZSY-MOsqUeZCek1x62DKz4Q@mail.gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=linux-mm@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.