Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443485

Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists
Date 2016-07-14 16:40 +0200
Message-ID <rUPXX-2rx-3@gated-at.bofh.it> (permalink)
References <rTNlv-1Jn-5@gated-at.bofh.it> <rTNlv-1Jn-15@gated-at.bofh.it> <rUv3b-5rv-5@gated-at.bofh.it> <rUNt8-N5-21@gated-at.bofh.it> <rUNt8-N5-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 14-07-16 07:50:43, Tejun Heo wrote:
> > > > +void dlock_list_add(struct dlock_list_node *node, struct dlock_list_head *head)
> > > > +{
> > > > +	struct dlock_list_head *myhead;
> > > > +
> > > > +	/*
> > > > +	 * Disable preemption to make sure that CPU won't gets changed.
> > > > +	 */
> > > > +	myhead = get_cpu_ptr(head);
> > > > +	spin_lock(&myhead->lock);
> > > > +	node->lockptr =&myhead->lock;
> > > > +	list_add(&node->list,&myhead->list);
> > > > +	spin_unlock(&myhead->lock);
> > > > +	put_cpu_ptr(head);
> > > > +}
> > > I wonder whether it'd be better to use irqsafe operations.  lists tend
> > > to be often used from irq contexts.
> > 
> > The current use case only need to use the regular lock functions. You are
> > right that future use cases may require an irqsafe version of locks. I can
> > either modify the code now to allow lock type selection at init time, for
> > example, or defer it as a future enhancement when the need arises. What do
> > you think?
> 
> The bulk of performance gain of dlist would come from being per-cpu
> and I don't think it's likely that we'd see any noticeable difference
> between irq and preempt safe operations.  Given that what's being
> implemented is really low level operations, I'd suggest going with
> irqsafe from the get-go.

I'm not sure here. i_sb_list for which percpu lists will be used is bashed
pretty heavily under some workloads and the cost of additional interrupt
disabling & enabling may be visible under those loads. Probably not in the
cases where you get a boost from percpu lists but if the workload is mostly
single-threaded, additional cpu cost may be measurable. So IMO we should
check whether a load which creates tons of empty inodes in tmpfs from a
single process doesn't regress with this change.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] vfs: Use dlock list for SB's s_inodes list Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [RFC PATCH v2 7/7] lib/dlock-list: Use the per-subnode APIs for managing lists Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected lists Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-13 18:20 +0200
      Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 14:00 +0200
        Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Jan Kara <jack@suse.cz> - 2016-07-14 16:40 +0200
          Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 17:00 +0200
        Re: [PATCH v2 1/7] lib/dlock-list: Distributed and lock-protected  lists Tejun Heo <tj@kernel.org> - 2016-07-14 19:50 +0200
  [PATCH v2 2/7] lib/dlock-list: Add __percpu modifier for parameters Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [PATCH v2 2/7] lib/dlock-list: Add __percpu modifier for  parameters Tejun Heo <tj@kernel.org> - 2016-07-13 18:20 +0200
  [PATCH v2 5/7] vfs: Use dlock list for superblock's inode list Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [PATCH v2 3/7] fsnotify: Simplify inode iteration on umount Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
  [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple per-subnode APIs Waiman Long <Waiman.Long@hpe.com> - 2016-07-11 19:40 +0200
    Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Boqun Feng <boqun.feng@gmail.com> - 2016-07-12 05:20 +0200
    Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Tejun Heo <tj@kernel.org> - 2016-07-12 16:30 +0200
      Re: [RFC PATCH v2 6/7] lib/persubnode: Introducing a simple  per-subnode APIs Tejun Heo <tj@kernel.org> - 2016-07-12 21:00 +0200

csiph-web