[lkml]   [2013]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/3] workqueue, async: implement work/async_current_func()
On Thu, Jan 17, 2013 at 5:25 PM, Tejun Heo <> wrote:
> Implement work/async_current_func() which query whether the current
> task is a workqueue or async worker respectively and, if so, return
> the current function being executed along with work / async item
> related information.

So why the odd interface? The only user of it calls it with a
NULL/NULL pair of arguments, and in general it's just way too complex
to be an exported function at all. I *suspect* you chose that complex
interface because you feel you may have some use for it inside of the
async code itself, but why isn't that then not totally private to

IOW, why isn't the interface just

static struct worker *current_worker(void)
if (current->flags & PF_WQ_WORKER)
return kthread_data(current);
return NULL;

int current_is_async(void)
struct worker *worker = current_worker(void);
return worker && worker->current_func == async_run_entry_fn;

and that current_is_async() is enough for the exported interface.

Then, if you actually want to care about the work itself, you can use
that same "current_worker()" helper function, and look at the
different worker fields more. But why export that kind of logic?

Am I missing something?


 \ /
  Last update: 2013-01-18 04:21    [W:2.083 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site