From: Dave Hansen <dave@sr71.net>
To: Christoph Lameter <cl@linux.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kirill.shutemov@linux.intel.com, Andi Kleen <ak@linux.intel.com>
Subject: Re: [RFC][PATCH 2/3] mm: slab: move around slab ->freelist for cmpxchg
Date: Thu, 12 Dec 2013 11:39:17 -0800 [thread overview]
Message-ID: <52AA10E5.9040708@sr71.net> (raw)
In-Reply-To: <00000142e7ea519d-8906d225-c99c-44b5-b381-b573c75fd097-000000@email.amazonses.com>
On 12/12/2013 09:46 AM, Christoph Lameter wrote:
> On Wed, 11 Dec 2013, Dave Hansen wrote:
>> The write-argument to cmpxchg_double() must be 16-byte aligned.
>> We used to align 'struct page' itself in order to guarantee this,
>> but that wastes 8-bytes per page. Instead, we take 8-bytes
>> internal to the page before page->counters and move freelist
>> between there and the existing 8-bytes after counters. That way,
>> no matter how 'stuct page' itself is aligned, we can ensure that
>> we have a 16-byte area with which to to this cmpxchg.
>
> Well this adds additional branching to the fast paths.
I don't think it *HAS* to inherently. The reason here is really that we
swap the _order_ of the arguments to the cmpxchg() since their order in
memory changes. Essentially, we do:
| flags | freelist | counters | |
| flags | | counters | freelist |
I did this so I wouldn't have to make a helper for ->counters. But, if
we also move counters around, we can do:
| flags | counters | freelist | |
| flags | | counters | freelist |
I believe we can do that all with plain pointer arithmetic and masks so
that it won't cost any branches.
--
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>
next prev parent reply other threads:[~2013-12-12 19:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 22:40 [RFC][PATCH 0/3] re-shrink 'struct page' when SLUB is on Dave Hansen
2013-12-11 22:40 ` [RFC][PATCH 1/3] mm: slab: create helpers for slab ->freelist pointer Dave Hansen
2013-12-12 19:32 ` Christoph Lameter
2013-12-11 22:40 ` [RFC][PATCH 2/3] mm: slab: move around slab ->freelist for cmpxchg Dave Hansen
2013-12-12 17:46 ` Christoph Lameter
2013-12-12 19:39 ` Dave Hansen [this message]
2013-12-12 23:40 ` Andi Kleen
2013-12-11 22:40 ` [RFC][PATCH 3/3] mm: slabs: reset page at free Dave Hansen
2013-12-12 17:44 ` Christoph Lameter
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=52AA10E5.9040708@sr71.net \
--to=dave@sr71.net \
--cc=ak@linux.intel.com \
--cc=cl@linux.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