[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150905051915.GC22011@ZenIV.linux.org.uk>
Date: Sat, 5 Sep 2015 06:19:15 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: yalin wang <yalin.wang2010@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Eric Dumazet <eric.dumazet@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Maciej Żenczykowski <maze@...gle.com>
Subject: Re: [PATCH] task_work: remove fifo ordering guarantee
On Mon, Aug 31, 2015 at 01:22:26PM +0800, yalin wang wrote:
> why not provide API like:
> fput()
> fput_nosync() ?
>
> because synchronous version are reasonable and safe in most time,
> let the user to select which version to use is more feasible, no matter if it is kthread or not.
Synchronous version is *NOT* safe in a lot of situations, from "deep enough
in kernel stack" to "now a function seven levels out in call chain happens
to hold a mutex grabbed elsewhere inside a mutex taken by unexpected
->release() instance, causing a deadlock", etc.
It's not sync vs. async; we still guarantee execution before return from
syscall. The only case when we really get async is kernel threads - there
we do *not* return to userland at all, so we have to schedule it really
asynchronous. Which is why we need an explicit sync version (for kernel
threads only, not exported, don't use unless you really understand what
you are doing and can explain why that particular case is safe, etc.)
--
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