From patchwork Mon May 25 21:47:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 11569467 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24D7490 for ; Mon, 25 May 2020 21:48:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E60AC2075F for ; Mon, 25 May 2020 21:48:16 +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 E60AC2075F 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8930F80061; Mon, 25 May 2020 17:48:14 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 2,0,0,6880b4ca705fff22,d41d8cd98f00b204,urezki@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:4250:4385:5007:6261:6653:7514:7576:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13149:13230:13311:13357:13894:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21740:21990:30012:30054,0,RBL:209.85.208.193:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none 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 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_cpu *krcp, if (!bnode) { WARN_ON_ONCE(sizeof(struct kfree_rcu_bulk_data) > PAGE_SIZE); + /* + * 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 = (struct kfree_rcu_bulk_data *) __get_free_page(GFP_NOWAIT | __GFP_NOWARN); }