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=-7.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 4E0AEC4724C for ; Wed, 6 May 2020 18:29:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCA9F206D5 for ; Wed, 6 May 2020 18:29:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B2G2eQWb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCA9F206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3DB148E0005; Wed, 6 May 2020 14:29:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B1B68E0003; Wed, 6 May 2020 14:29:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C89A8E0005; Wed, 6 May 2020 14:29:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 145B08E0003 for ; Wed, 6 May 2020 14:29:10 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D1837180AD811 for ; Wed, 6 May 2020 18:29:09 +0000 (UTC) X-FDA: 76787131218.19.twig87_6d11d0bbdb93b X-HE-Tag: twig87_6d11d0bbdb93b X-Filterd-Recvd-Size: 7106 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 May 2020 18:29:09 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id g10so2187212lfj.13 for ; Wed, 06 May 2020 11:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8uFfjmJQ34Ru3+2rUtoTfL18MZiFWub+orW6ZjEFZRo=; b=B2G2eQWb2vvv7fGShDkInZMoYpb5intPAkogP/WM+B1lyOz6hgaR+2isDwT+Ua0RGs DKUjdW3hd7Czozq5VmF6WA8w0ETsyD4juwlKXUWM0HhHJTybEaISjD+NSDPKKb5WM8P0 gwGQdM2F3Lt7Rn0B8/F0eFcTyRJWxvESRPSiGUj8KW0ON6nQbK+ZXVCrRhlpWrF4/Tfj orT06Ya+LJeldPqwet+suG8UAF7Q513Yt2ugIpkrbTvZZAaSrOzNNoXoi23t8cXH2hHa qxlX1m4v/1hDvdNWBbyxD6j4G3mWbCijMhO5wIcvxzL7XBeD7mvMpCpI6xl++o1hEP6c nzXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=8uFfjmJQ34Ru3+2rUtoTfL18MZiFWub+orW6ZjEFZRo=; b=W3K00N/JrGApd5tzy2dbfwHoAY74XKGxhGqf1SSIenmJQ69yfCXEKYY1+4d+lsUkfj NtbSP/3MZ6aLiWPNHrKHoQYRu8zwx2lH1yc77hDLAJGDTLA5HbGWh1inFprSuPbzwL44 P9lji2KI+t0p7+njeWQzCHRJY2+qb8rSf4CVI8HtJHKErNd2rt/Zs3tQ95l2QKPOKsAP lYRsMOBA892KegPoqWF6KAvDbpPFSbAWbLPMMzRMcml0B5SaLfrLLg7PTaJANLl134Sq skoy2nRuaEOrNvDNoO/vJdcIB77HjJZemDxGQ6zMVax7q0hwrRif1tD1sRc5NEFzw6Vl 6VKw== X-Gm-Message-State: AGi0PuZjgbXlSa9WflfQqkEClujEZil0Yu8w2IMKHyMJnbgwfgcYlvAA EgaHsGOM9bEgoVT5zTc/dBQ= X-Google-Smtp-Source: APiQypL1LY97fVbP2+jltuM+HvwXjcF4mVPnXUQNAfSzdtg6CT3iunNViZ4JrqjCI8ILfl0mNb58eA== X-Received: by 2002:a19:5053:: with SMTP id z19mr6231192lfj.177.1588789747650; Wed, 06 May 2020 11:29:07 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id x24sm1812474lji.52.2020.05.06.11.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 11:29:04 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 6 May 2020 20:29:02 +0200 To: "Paul E. McKenney" , Joel Fernandes Cc: "Uladzislau Rezki (Sony)" , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , RCU , Oleksiy Avramchenko Subject: Re: [PATCH 21/24] rcu/tiny: move kvfree_call_rcu() out of header Message-ID: <20200506182902.GA2570@pc636> References: <20200428205903.61704-1-urezki@gmail.com> <20200428205903.61704-22-urezki@gmail.com> <20200501230359.GH7560@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200501230359.GH7560@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) 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: Hello, Paul, Joel. > > 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(void) > > synchronize_rcu(); > > } > > =20 > > -static inline void kvfree_call_rcu(struct rcu_head *head, rcu_callba= ck_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_callbac= k_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-argument > 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: 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 kvfree() is defined in as extern void kvfree(const void *add= r);=20 If i just include i get many errors related to "implicit dec= laration of function" like: rcu_read_lock() compound_mapcount_ptr() rcu_assign_pointer() ... and many other messages like: warning: returning =E2=80=98int=E2=80=99 from a function with return type 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 ... Please see full log here: ftp://vps418301.ovh.net/incoming/include_mm_h_o= utput.txt I can fix it by adding the kvfree() declaration to the rcutiny.h also: extern void kvfree(const void *addr); 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. Any valuable proposals? -- Vlad Rezki