[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120623194505.GI14083@ZenIV.linux.org.uk>
Date: Sat, 23 Jun 2012 20:45:05 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Mimi Zohar <zohar@...ux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
". James Morris" <jmorris@...ei.org>,
linux-security-module@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: deferring __fput()
On Sat, Jun 23, 2012 at 10:20:49AM +0100, Al Viro wrote:
> What I have in mind is something like
> if (unlikely(in_atomic() || current->flags & PF_KTHREAD))
> move file to global list, use schedul_work() to have it dealt with
> else
> move to per-task list, do task_work_add() if it was empty (i.e.
> if we hadn't scheduled its emptying already).
> The latter is completely thread-synchronous, so we shouldn't need any locking
> whatsoever. The former... I'd probably go for a single list, protected by
> spin_lock_irq(), keeping the possibility to switch to per-CPU lists if we
> find a load that gets serious contention on that list. In any case, worker will
> start with taking the list contents, emptying the list and then killing the
> suckers off one by one.
BTW, I really wonder why do we need to have that void *data in task_work; we can
always embed the sucker into a bigger struct (if nothing else, task_work +
void *data) and get to it via container_of(). And in quite a few cases we don't
want that data thing at all. Moreover, the reasons to use hlist_head instead of
a single forward pointer are very thin on the ground:
* task_work_add() adds to the beginning of the list
* task_work_cancel() walks the list to find the entry to remove
* trask_work_run() takes the list out, walks it to the end,
then walks it backwards via pprev. Could as well reverse the pointers
while walking forward...
Oleg, do you see any reasons why trimming it down to forward pointer + callback
pointer wouldn't work? Matter of fact, it would become identical to struct rcu_head
after that...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists