From: Vitaly Wool <vitalywool@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Dan Streetman <ddstreet@ieee.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH/RFC] z3fold: use per-page read/write lock
Date: Sun, 6 Nov 2016 10:42:49 +0100 [thread overview]
Message-ID: <CAMJBoFNWV92c5B3HLJ=6wgNNUJFpTUgu3qf1mWgYxTEhfaA_LA@mail.gmail.com> (raw)
In-Reply-To: <87lgwxo5u9.fsf@tassilo.jf.intel.com>
On Sun, Nov 6, 2016 at 12:38 AM, Andi Kleen <andi@firstfloor.org> wrote:
> Vitaly Wool <vitalywool@gmail.com> writes:
>
>> Most of z3fold operations are in-page, such as modifying z3fold
>> page header or moving z3fold objects within a page. Taking
>> per-pool spinlock to protect per-page objects is therefore
>> suboptimal, and the idea of having a per-page spinlock (or rwlock)
>> has been around for some time. However, adding one directly to the
>> z3fold header makes the latter quite big on some systems so that
>> it won't fit in a signle chunk.
>
>> + atomic_t page_lock;
>
> This doesnt make much sense. A standard spinlock is not bigger
> than 4 bytes either. Also reinventing locks is usually a bad
> idea: they are tricky to get right, you have no debugging support,
> hard to analyze, etc.
I understand the reinvention part but you're not quite accurate here
with the numbers.
E. g. on x86_64:
(gdb) p sizeof(rwlock_t)
$1 = 8
I believe a DIY lock is justified here, since the variant with
rwlock_t actually caused complaints from kbuild test robot building
the previous version of this patch [1] with gcc-6.0 for x86_64:
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from mm/z3fold.c:25:
mm/z3fold.c: In function 'init_z3fold':
>> include/linux/compiler.h:518:38: error: call to '__compiletime_assert_808' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct z3fold_header) > ZHDR_SIZE_ALIGNED
~vitaly
[1] https://patchwork.kernel.org/patch/9384871/
--
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:[~2016-11-06 9:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-05 13:49 Vitaly Wool
2016-11-05 23:38 ` Andi Kleen
2016-11-06 9:42 ` Vitaly Wool [this message]
2016-11-07 16:06 ` Andi Kleen
2016-11-10 19:38 ` Peter Zijlstra
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='CAMJBoFNWV92c5B3HLJ=6wgNNUJFpTUgu3qf1mWgYxTEhfaA_LA@mail.gmail.com' \
--to=vitalywool@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=ddstreet@ieee.org \
--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