From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Andrey Vagin <avagin@openvz.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
David Howells <dhowells@redhat.com>,
linux-kernel@vger.kernel.org, Huang Ying <ying.huang@intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 0/3] (Was: fput: task_work_add() can fail if the caller has passed exit_task_work())
Date: Sat, 15 Jun 2013 19:29:59 +0200 [thread overview]
Message-ID: <20130615172959.GA14656@redhat.com> (raw)
In-Reply-To: <20130614145831.c65ad42447637e3ad33eb79d@linux-foundation.org>
On 06/14, Andrew Morton wrote:
>
> On Fri, 14 Jun 2013 21:09:47 +0200 Oleg Nesterov <oleg@redhat.com> wrote:
>
> > + if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
> > + init_task_work(&file->f_u.fu_rcuhead, ____fput);
> > + if (!task_work_add(task, &file->f_u.fu_rcuhead, true))
> > + return;
>
> A comment here would be useful, explaining the circumstances under
> which we fall through to the delayed fput.
Thanks!
> This is particularly needed
> because kernel/task_work.c is such undocumented crap.
It seems that you are trying to force me to make the doc patch ;)
OK, I'll try. task_work.c needs a couple of cosmetic cleanups anyway.
> > + spin_lock_irqsave(&delayed_fput_lock, flags);
> > + list_add(&file->f_u.fu_list, &delayed_fput_list);
> > + schedule_work(&delayed_fput_work);
> > + spin_unlock_irqrestore(&delayed_fput_lock, flags);
>
> OT: I don't think that schedule_work() needs to be inside the locked
> region. Scalability improvements beckon!
Yeees, I thought about this too.
Performance-wise this can't really help, this case is unlikely. But
I think this change makes this code a bit simpler, so please see 1/3.
2/3 fixes the (theoretical) bug in llist_add() and imho cleanups the
code.
3/3 comes as a separate change because I do not want to argue if
someone dislike the non-inline llist_add(). But once again, we can
make llist_add_batch() inline, and I believe it is never good to
duplicate the code even if it is simple.
Oleg.
next prev parent reply other threads:[~2013-06-15 17:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 19:09 [PATCH 0/2] fix ->shm_file leak Oleg Nesterov
2013-06-14 19:09 ` [PATCH 1/2] fput: task_work_add() can fail if the caller has passed exit_task_work() Oleg Nesterov
2013-06-14 21:58 ` Andrew Morton
2013-06-15 17:29 ` Oleg Nesterov [this message]
2013-06-15 17:30 ` [PATCH 1/3] fput: turn "list_head delayed_fput_list" into llist_head Oleg Nesterov
2013-06-15 17:30 ` [PATCH 2/3] llist: fix/simplify llist_add() and llist_add_batch() Oleg Nesterov
2013-06-15 17:30 ` [PATCH 3/3] llist: llist_add() can use llist_add_batch() Oleg Nesterov
2013-06-15 17:46 ` [PATCH 0/3] (Was: fput: task_work_add() can fail if the caller has passed exit_task_work()) Oleg Nesterov
2013-06-14 19:09 ` [PATCH 2/2] move exit_task_namespaces() outside of exit_notify() Oleg Nesterov
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=20130615172959.GA14656@redhat.com \
--to=oleg@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=ying.huang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.