Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1426970
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Tejun Heo <tj@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v9 05/12] kthread: Add kthread_create_worker*() |
| Date | Mon, 20 Jun 2016 22:00:01 +0200 |
| Message-ID | <rMdwt-44L-7@gated-at.bofh.it> (permalink) |
| References | <rKDv3-7Hj-3@gated-at.bofh.it> <rKDv3-7Hj-7@gated-at.bofh.it> |
| X-Original-To | Petr Mladek <pmladek@suse.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VGoiqg6Z3KW3NW0A60UYulLmFtRnDZHtSgI5QOeUxug=; b=RJ0b91ipjdp5d0UmT1+4KdXU1UlouhaO6MQBKnOOlSFRkkTSUJARs3n+AhgA4j65fZ kA57B7tczLocWVRYtTB6xgVFuh+3RNAKILel/Tyf6KPC1ePg54RWroFi6a6Yg5LGfWrM nJDmcZGUxZCZ958E80+PazVEqfqfTz1fXIw8wkP9glE/aA2hAk9neHYkN0aAy/JEKJG+ g3lDjKlnIxPUFbQQes1Vc8EQXvzM1qOQ2m4MzwUCeZpSR6HB8KDVdzeMuMcsfRkDTx1T NSSMO2qkjawo4/ICM/30jjDX9KeWeoZxcA5bSJV6AMXySy9ji7J89gGSa+GFPjfHKvfW 2cng== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=VGoiqg6Z3KW3NW0A60UYulLmFtRnDZHtSgI5QOeUxug=; b=NPBC+vZkCAbPi5g6lJ7aFLLCAk0ET66Ew9YpPrWPo34m5n4FGE3xgZJE0Nz3jXMkHD fvU/5ydy8y4dKHuLQH55UjYhkvdCCwiOlQufwHISRLswKcfV9H0RVOeu1dC/xxWuhLWx FotKKqp+zbVIujfjuY6dBEJ6Dv8YSjtJL2Apg2e8bQksS25uYFhiK9saZMQhLlZNzslr hMPrExviv7dWKqZyikWDBaFsnosq+tyoanTcTn3+wxskI7dSGXJVu/M6rIfdrcYQxlZT Jxw+APj1jsLy+nBswByoWE1mb+RfVHRDD5+p6XroCi9T/JczSRPXcd1AMTdrwqDyxQcL KUGA== |
| X-Gm-Message-State | ALyK8tLDa/L6Op45rj5xAPV2dpxRJvu5pMSeOcwp9wIPQ0mDk4+32Bkwo8Z8JgFfNZlh6g== |
| X-Received | by 10.37.77.137 with SMTP id a131mr9991265ybb.1.1466452545852; Mon, 20 Jun 2016 12:55:45 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.6.1 (2016-04-27) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 49 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Andrew Morton <akpm@linux-foundation.org>, Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Steven Rostedt <rostedt@goodmis.org>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Josh Triplett <josh@joshtriplett.org>, Thomas Gleixner <tglx@linutronix.de>, Linus Torvalds <torvalds@linux-foundation.org>, Jiri Kosina <jkosina@suse.cz>, Borislav Petkov <bp@suse.de>, Michal Hocko <mhocko@suse.cz>, linux-mm@kvack.org, Vlastimil Babka <vbabka@suse.cz>, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Mon, 20 Jun 2016 15:55:44 -0400 |
| X-Original-Message-ID | <20160620195544.GW3262@mtj.duckdns.org> |
| X-Original-References | <1466075851-24013-1-git-send-email-pmladek@suse.com> <1466075851-24013-6-git-send-email-pmladek@suse.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1426970 |
Show key headers only | View raw
On Thu, Jun 16, 2016 at 01:17:24PM +0200, Petr Mladek wrote: > Kthread workers are currently created using the classic kthread API, > namely kthread_run(). kthread_worker_fn() is passed as the @threadfn > parameter. > > This patch defines kthread_create_worker() and > kthread_create_worker_on_cpu() functions that hide implementation details. > > They enforce using kthread_worker_fn() for the main thread. But I doubt > that there are any plans to create any alternative. In fact, I think > that we do not want any alternative main thread because it would be > hard to support consistency with the rest of the kthread worker API. > > The naming and function of kthread_create_worker() is inspired by > the workqueues API like the rest of the kthread worker API. > > The kthread_create_worker_on_cpu() variant is motivated by the original > kthread_create_on_cpu(). Note that we need to bind per-CPU kthread > workers already when they are created. It makes the life easier. > kthread_bind() could not be used later for an already running worker. > > This patch does _not_ convert existing kthread workers. The kthread worker > API need more improvements first, e.g. a function to destroy the worker. > > IMPORTANT: > > kthread_create_worker_on_cpu() allows to use any format of the > worker name, in compare with kthread_create_on_cpu(). The good thing > is that it is more generic. The bad thing is that most users will > need to pass the cpu number in two parameters, e.g. > kthread_create_worker_on_cpu(cpu, "helper/%d", cpu). > > To be honest, the main motivation was to avoid the need for an > empty va_list. The only legal way was to create a helper function that > would be called with an empty list. Other attempts caused compilation > warnings or even errors on different architectures. > > There were also other alternatives, for example, using #define or > splitting __kthread_create_worker(). The used solution looked > like the least ugly. > > Signed-off-by: Petr Mladek <pmladek@suse.com> Acked-by: Tejun Heo <tj@kernel.org> Thanks. -- tejun
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v9 05/12] kthread: Add kthread_create_worker*() Petr Mladek <pmladek@suse.com> - 2016-06-16 13:20 +0200 Re: [PATCH v9 05/12] kthread: Add kthread_create_worker*() Tejun Heo <tj@kernel.org> - 2016-06-20 22:00 +0200
csiph-web