From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3819C433EF for ; Thu, 21 Oct 2021 13:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA8EF611F2 for ; Thu, 21 Oct 2021 13:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbhJUOBR (ORCPT ); Thu, 21 Oct 2021 10:01:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:40572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbhJUOBR (ORCPT ); Thu, 21 Oct 2021 10:01:17 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF4AB60F46; Thu, 21 Oct 2021 13:58:59 +0000 (UTC) Date: Thu, 21 Oct 2021 09:58:58 -0400 From: Steven Rostedt To: Cai Huoqing Cc: Bernard Metzler , Doug Ledford , Jason Gunthorpe , Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , "Ingo Molnar" , Daniel Bristot de Oliveira , , , Subject: Re: [PATCH 1/6] kthread: Add the helper macro kthread_run_on_cpu() Message-ID: <20211021095858.51d600fc@gandalf.local.home> In-Reply-To: <20211021135312.GA3400@LAPTOP-UKSR4ENP.internal.baidu.com> References: <20211021120135.3003-1-caihuoqing@baidu.com> <20211021120135.3003-2-caihuoqing@baidu.com> <20211021091001.26c24d5b@gandalf.local.home> <20211021135312.GA3400@LAPTOP-UKSR4ENP.internal.baidu.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, 21 Oct 2021 21:53:12 +0800 Cai Huoqing wrote: > > > +/** > > > + * kthread_run_on_cpu - create and wake a cpu bound thread. > > > + * @threadfn: the function to run until signal_pending(current). > > > + * @data: data ptr for @threadfn. > > > + * @cpu: The cpu on which the thread should be bound, > > > + * @namefmt: printf-style name for the thread. Format is restricted > > > + * to "name.*%u". Code fills in cpu number. > > > + * > > > + * Description: Convenient wrapper for kthread_create_on_node() > > > + * followed by wake_up_process(). Returns the kthread or > > > + * ERR_PTR(-ENOMEM). > > > + */ > > > +#define kthread_run_on_cpu(threadfn, data, cpu, namefmt) \ > > > > Why is this a macro and not a static inline function? > > > > -- Steve > Hi,Thanks for your feedback, > > I think using static inline function is nice, but here try to keep > consistent with the other macros, > sush as kthread_create/kthread_init_work... Which they did because they didn't want to use va_list to have variable arguments, which you don't have. Which begs the question, should you? -- Steve