[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03d94f25-5979-d0a4-97a8-5d07555b47da@redhat.com>
Date: Thu, 5 Oct 2017 09:40:53 -0400
From: Waiman Long <longman@...hat.com>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.com>,
Jeff Layton <jlayton@...chiereds.net>,
"J. Bruce Fields" <bfields@...ldses.org>,
Tejun Heo <tj@...nel.org>,
Christoph Lameter <cl@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andi Kleen <andi@...stfloor.org>,
Dave Chinner <dchinner@...hat.com>,
Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH v6 6/6] lib/dlock-list: Provide IRQ-safe APIs
On 10/04/2017 06:46 PM, Davidlohr Bueso wrote:
> On Wed, 04 Oct 2017, Waiman Long wrote:
>
>> To enable the use of dlock-list in an interrupt handler, the following
>> new APIs are provided for a irqsafe dlock-list:
>>
>> - void dlock_list_unlock_irqsafe(struct dlock_list_iter *)
>> - void dlock_list_relock_irqsafe(struct dlock_list_iter *)
>> - void dlock_list_add_irqsafe(struct dlock_list_node *,
>> struct dlock_list_head *);
>> - void dlock_lists_add_irqsafe(struct dlock_list_node *,
>> struct dlock_list_heads *)
>> - void dlock_lists_del_irqsafe(struct dlock_list_node *)
>>
>> New macros for irqsafe dlock-list:
>>
>> - dlist_for_each_entry_irqsafe(pos, iter, member)
>> - dlist_for_each_entry_safe_irqsafe(pos, n, iter, member)
>
> Instead of adding more calls to the api, could we not just use the
> irqsave/restore as part of the regular api?
>
> Thanks,
> Davidlohr
The irqsave/restore spinlock calls are more expensive in term of
performance. I think the spin_lock_irqrestore() is especially bad in a
VM as it probably causes a VMexit. So I try to avoid them unless it is
absolutely necessary.
Another alternative is to specify the dlock-list type at allocation time
and use either regular spinlock calls or irqsave/restore calls
accordingly. That will add a bit of overhead for users that don't need
irq safety, but much less than using irqsave/restore for all. I was
using that approach originally, but opt for the current solution for
performance reason. I can revert back to my original approach and send
out an updated patch.
Cheers,
Longman
Powered by blists - more mailing lists