From: Waiman Long <waiman.long@hpe.com>
To: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.com>, Jeff Layton <jlayton@poochiereds.net>,
"J. Bruce Fields" <bfields@fieldses.org>,
<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Andi Kleen <andi@firstfloor.org>,
Dave Chinner <dchinner@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>,
Scott J Norton <scott.norton@hpe.com>,
Douglas Hatch <doug.hatch@hpe.com>
Subject: Re: [PATCH v4 0/5] vfs: Use dlock list for SB's s_inodes list
Date: Mon, 8 Aug 2016 23:26:50 -0400 [thread overview]
Message-ID: <57A94D7A.6080203@hpe.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1607271004280.25485@east.gentwo.org>
On 07/27/2016 11:12 AM, Christoph Lameter wrote:
> On Mon, 25 Jul 2016, Tejun Heo wrote:
>
>> I don't get it. What's the harm of using percpu memory here? Other
>> percpu data structures have remote access too. They're to a lower
>> degree but I don't see a clear demarcation line and making addtions
>> per-cpu seems to have significant benefits here. If there's a better
>> way of splitting the list and locking, sure, let's try that but short
>> of that I don't see anything wrong with doing this per-cpu.
> For the regular global declarations we have separate areas for "SHARED"
> per cpu data like this. See DECLARE_PER_CPU_SHARED* and friends.
>
> Even if you align a percpu_alloc() there is still the possibility that
> other percpu variables defined after this will suffer from aliasing.
> The aligning causes space to be wasted for performance critical areas
> where you want to minimize cache line usage. The variables cannot be
> packed as densely as before. I think allocations like this need to be
> separate. Simply allocate an array of these structs using
>
> kcalloc(nr_cpu_ids, sizeof(my_struct), GFP_KERNEL)?
>
> Why bother with percpu_alloc() if its not per cpu data?
>
> Well if we do not care about that detail that much then lets continue going down this patch.
>
I think that make sense. The various lists don't really need to be in
the percpu area. Allocated as an array may increase contention a bit
when multiple CPUs try to access the list heads that happen to be in the
same cacheline. However, it can speed up dlock list iterations as less
cachelines need to be traversed. I will make the change to allocate the
head array using kcalloc instead of using the percpu_alloc.
Thanks for the suggestion.
Cheers,
Longman
prev parent reply other threads:[~2016-08-09 3:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 20:35 [PATCH v4 0/5] vfs: Use dlock list for SB's s_inodes list Waiman Long
2016-07-22 20:35 ` [PATCH v4 1/5] lib/dlock-list: Distributed and lock-protected lists Waiman Long
2016-07-22 20:35 ` [PATCH v4 2/5] fsnotify: Simplify inode iteration on umount Waiman Long
2016-07-22 20:35 ` [PATCH v4 3/5] vfs: Remove unnecessary list_for_each_entry_safe() variants Waiman Long
2016-07-22 20:35 ` [PATCH v4 4/5] vfs: Use dlock list for superblock's inode list Waiman Long
2016-07-22 20:35 ` [PATCH v4 5/5] lib/dlock-list: Allow cacheline alignment of percpu head Waiman Long
2016-07-25 13:48 ` [PATCH v4 0/5] vfs: Use dlock list for SB's s_inodes list Christoph Lameter
2016-07-25 17:41 ` Tejun Heo
2016-07-27 15:12 ` Christoph Lameter
2016-08-09 3:26 ` Waiman Long [this message]
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=57A94D7A.6080203@hpe.com \
--to=waiman.long@hpe.com \
--cc=andi@firstfloor.org \
--cc=bfields@fieldses.org \
--cc=boqun.feng@gmail.com \
--cc=cl@linux.com \
--cc=dchinner@redhat.com \
--cc=doug.hatch@hpe.com \
--cc=jack@suse.com \
--cc=jlayton@poochiereds.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=scott.norton@hpe.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).