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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146AEC4724C for ; Wed, 6 May 2020 18:45:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C111A2186A for ; Wed, 6 May 2020 18:45:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zh8rGp7e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C111A2186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 617C58E0006; Wed, 6 May 2020 14:45:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C8FF8E0003; Wed, 6 May 2020 14:45:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DE968E0006; Wed, 6 May 2020 14:45:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 37FE98E0003 for ; Wed, 6 May 2020 14:45:50 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EFB5E181AEF31 for ; Wed, 6 May 2020 18:45:49 +0000 (UTC) X-FDA: 76787173218.04.rose65_6d0aded670e54 X-HE-Tag: rose65_6d0aded670e54 X-Filterd-Recvd-Size: 6286 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 May 2020 18:45:49 +0000 (UTC) Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (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 5CC2520708; Wed, 6 May 2020 18:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588790748; bh=gigegsw9Oj8TIYgU47530V44T98t2OPVL9trxrvvp2M=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Zh8rGp7exfpuWXwr7XwnPrHVTETtgSr7bqT7m4Z/r7W2Mu+9R+/XZ/MMRN8wnwda1 Xz3yfCschfOlBqh8qNPY7jUmpm6G0vwd+WAH1GIwtNlf4Oj0MF4Plqr9lM2OtG7qIA cUWfHS3O6z9mKxrdMz5sfCl9zGowQEHy0YVOs5nk= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 4457E352306C; Wed, 6 May 2020 11:45:48 -0700 (PDT) Date: Wed, 6 May 2020 11:45:48 -0700 From: "Paul E. McKenney" To: Uladzislau Rezki Cc: Joel Fernandes , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , RCU , Oleksiy Avramchenko Subject: Re: [PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header Message-ID: <20200506184548.GE2869@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200428205903.61704-1-urezki@gmail.com> <20200428205903.61704-22-urezki@gmail.com> <20200501230359.GH7560@paulmck-ThinkPad-P72> <20200506182902.GA2570@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200506182902.GA2570@pc636> User-Agent: Mutt/1.9.4 (2018-02-28) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, May 06, 2020 at 08:29:02PM +0200, Uladzislau Rezki wrote: > Hello, Paul, Joel. >=20 > > > Move inlined kvfree_call_rcu() function out of the > > > header file. This step is a preparation for head-less > > > support. > > >=20 > > > Reviewed-by: Joel Fernandes (Google) > > > Signed-off-by: Uladzislau Rezki (Sony) > > > --- > > > include/linux/rcutiny.h | 6 +----- > > > kernel/rcu/tiny.c | 6 ++++++ > > > 2 files changed, 7 insertions(+), 5 deletions(-) > > >=20 > > > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h > > > index 0c6315c4a0fe..7eb66909ae1b 100644 > > > --- a/include/linux/rcutiny.h > > > +++ b/include/linux/rcutiny.h > > > @@ -34,11 +34,7 @@ static inline void synchronize_rcu_expedited(voi= d) > > > synchronize_rcu(); > > > } > > > =20 > > > -static inline void kvfree_call_rcu(struct rcu_head *head, rcu_call= back_t func) > > > -{ > > > - call_rcu(head, func); > > > -} > > > - > > > +void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func); > > > void rcu_qs(void); > > > =20 > > > static inline void rcu_softirq_qs(void) > > > diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c > > > index aa897c3f2e92..508c82faa45c 100644 > > > --- a/kernel/rcu/tiny.c > > > +++ b/kernel/rcu/tiny.c > > > @@ -177,6 +177,12 @@ void call_rcu(struct rcu_head *head, rcu_callb= ack_t func) > > > } > > > EXPORT_SYMBOL_GPL(call_rcu); > > > =20 > > > +void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func) > > > +{ > > > + call_rcu(head, func); > > > +} > > > +EXPORT_SYMBOL_GPL(kvfree_call_rcu); > >=20 > > This increases the size of Tiny RCU. Plus in Tiny RCU, the overhead = of > > synchronize_rcu() is exactly zero. So why not make the single-argume= nt > > kvfree_call_rcu() just unconditionally do synchronize_rcu() followed = by > > kvfree() or whatever? That should go just fine into the header file. > >=20 > Seems it does not go well if i do it in header file: >=20 > > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h > index 0c6315c4a0fe..76b7ad053218 100644 > --- a/include/linux/rcutiny.h > +++ b/include/linux/rcutiny.h > @@ -13,6 +13,7 @@ > #define __LINUX_TINY_H > =20 > #include /* for HZ */ > +#include > =20 > /* Never flag non-existent other CPUs! */ > static inline bool rcu_eqs_special_set(int cpu) { return false; } > @@ -36,7 +37,15 @@ static inline void synchronize_rcu_expedited(void) > =20 > static inline void kvfree_call_rcu(struct rcu_head *head, rcu_callback= _t func) > { > - call_rcu(head, func); > + if (head) { > + call_rcu(head, func); > + return; > + } > + > + // kvfree_rcu(one_arg) call. > + might_sleep(); > + synchronize_rcu(); > + kvfree((void *) func); > } > =20 >=20 > kvfree() is defined in as extern void kvfree(const void *a= ddr);=20 > If i just include i get many errors related to "implicit d= eclaration > of function" like: >=20 > > rcu_read_lock() > compound_mapcount_ptr() > rcu_assign_pointer() > ... > >=20 > and many other messages like: >=20 > > warning: returning =E2=80=98int=E2=80=99 from a function with return ty= pe > error: unknown type name =E2=80=98vm_fault_t=E2=80=99; did you mean =E2= =80=98pmdval_t=E2=80=99? > error: implicit declaration of function =E2=80=98RB_EMPTY_ROOT=E2=80=99 > ... > >=20 > Please see full log here: ftp://vps418301.ovh.net/incoming/include_mm_h= _output.txt >=20 > I can fix it by adding the kvfree() declaration to the rcutiny.h also: > extern void kvfree(const void *addr); >=20 > what seems wired to me? Also it can be fixed if i move it to the tiny.c > so it will be aligned with the way how it is done for tree-RCU. If the mm guys are OK with the kvfree() declaration, that is the way to go. With the addition of a comment saying something like "Avoid #include hell". The compiler will complain if the definition changes given that there has to be somewhere that sees both the above and the real declaration, so this should not cause too much trouble. > Any valuable proposals? Otherwise, yes, the function would need to move to tiny.c and thus add bloat. :-( Thanx, Paul