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=-9.3 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_GIT 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 12E9CC433DF for ; Mon, 25 May 2020 21:48:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C567E207CB for ; Mon, 25 May 2020 21:48:15 +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="oCYyc5EZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C567E207CB 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 9A2A380062; Mon, 25 May 2020 17:48:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8930F80061; Mon, 25 May 2020 17:48:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 756B680062; Mon, 25 May 2020 17:48:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 5D31680061 for ; Mon, 25 May 2020 17:48:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1DAF7180AD815 for ; Mon, 25 May 2020 21:48:14 +0000 (UTC) X-FDA: 76856580108.13.stamp20_2ac18b4ea593f X-HE-Tag: stamp20_2ac18b4ea593f X-Filterd-Recvd-Size: 5235 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 May 2020 21:48:13 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id v16so22189149ljc.8 for ; Mon, 25 May 2020 14:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uuS6fohvwHxuxWslRa3zOPr8O2j4OSUqCY5jL2HzmNU=; b=oCYyc5EZyHOL7pZjQCoROI4cZ7ULkiquYBF6HgEf+xj0qvTO/WfJp/9ksJNHuwAW42 jb4i+YHZK+iYQmSS0jE7yB7qXRO4BUBgpi6FlsphLeExsSAw6Ocz/pm1/jsYkK06L/62 YVvcqo08OBHInb6GIAoCCdqp79ZMpz73UTzIUY7G7MbGMjnwATjkvVA8htZ8P3cviT3S uZgnzRf82KNhueY1bygWe3QbX31XJSqrmPl/p77bhm8kKLCDURdSZcVFzSdmi6BimqWU s57xfoqdk5SaNCBIamiosFZNsms7W+239z0nlblFvmGpRWrEsokCqmQ3fGjEyGWRgLjM EroQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uuS6fohvwHxuxWslRa3zOPr8O2j4OSUqCY5jL2HzmNU=; b=jIVyDF2ZcvVG0OojQ9BIAXAZl0Rm3XXxel/W/N7BAMHe2q/J/4mqKEHZeoT7pyODgs 0zQYiiE9ssZP+hfmoPLCkbb81VujJ0CAXhQEaTxEPLnv/QmCvfwvMi3+3sDiq8eDAUR1 rZEsy/W36ThKjwAO5UdJs6wu2qYCpDKH+TQxRWh02sxCDbKgAvrR0oyWjOKffp61WTDq Smt3u40O/+vumPE0F8D7/bsmZJlwOrQoKjOh6nxz1P/CLOXSRD0fTe4XYY+//xhtc1kZ WvkoLFq05er7McxQrxgMfNTHojNZjRJuwNdEjZYSrc5jZOcNyvDJ5T4j2JESEKlEANJm U5Dg== X-Gm-Message-State: AOAM533DeG7dFeS347Wldy/YSGec6CHM2xMZjwkMST/szUv+mW+2is7X FGTCtwcj1k/VXbi5T5ZPibE= X-Google-Smtp-Source: ABdhPJzeCk2tHSENorydlmBycYrCOOWzwq7850vGWkJweiyMNVAzHv3gLgrw3ynteKptKefS6PxAKQ== X-Received: by 2002:a2e:9d45:: with SMTP id y5mr13895293ljj.258.1590443292528; Mon, 25 May 2020 14:48:12 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id a6sm2280044lji.29.2020.05.25.14.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 14:48:11 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: LKML , linux-mm@kvack.org Cc: Andrew Morton , "Paul E . McKenney" , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , RCU , Uladzislau Rezki , Oleksiy Avramchenko , Sebastian Andrzej Siewior Subject: [PATCH v2 02/16] rcu/tree: Skip entry into the page allocator for PREEMPT_RT Date: Mon, 25 May 2020 23:47:46 +0200 Message-Id: <20200525214800.93072-3-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200525214800.93072-1-urezki@gmail.com> References: <20200525214800.93072-1-urezki@gmail.com> MIME-Version: 1.0 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: From: "Joel Fernandes (Google)" To keep the kfree_rcu() code working in purely atomic sections on RT, such as non-threaded IRQ handlers and raw spinlock sections, avoid calling into the page allocator which uses sleeping locks on RT. In fact, even if the caller is preemptible, the kfree_rcu() code is not, as the krcp->lock is a raw spinlock. Calling into the page allocator is optional and avoiding it should be Ok, especially with the page pre-allocation support in future patches. Such pre-allocation would further avoid the a need for a dynamically allocated page in the first place. Cc: Sebastian Andrzej Siewior Reviewed-by: Uladzislau Rezki Co-developed-by: Uladzislau Rezki Signed-off-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 6e967a9d6704..d28010cf158b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3068,6 +3068,18 @@ kfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cp= u *krcp, if (!bnode) { WARN_ON_ONCE(sizeof(struct kfree_rcu_bulk_data) > PAGE_SIZE); =20 + /* + * To keep this path working on raw non-preemptible + * sections, prevent the optional entry into the + * allocator as it uses sleeping locks. In fact, even + * if the caller of kfree_rcu() is preemptible, this + * path still is not, as krcp->lock is a raw spinlock. + * With additional page pre-allocation in the works, + * hitting this return is going to be much less likely. + */ + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + return false; + bnode =3D (struct kfree_rcu_bulk_data *) __get_free_page(GFP_NOWAIT | __GFP_NOWARN); } --=20 2.20.1