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=-12.8 required=3.0 tests=BAYES_00, 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 6AF90C433DF for ; Sun, 9 Aug 2020 20:44:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28152206A2 for ; Sun, 9 Aug 2020 20:44:12 +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="oPiShrji" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28152206A2 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 4BF496B0006; Sun, 9 Aug 2020 16:44:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 496946B0007; Sun, 9 Aug 2020 16:44:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AE0A6B0008; Sun, 9 Aug 2020 16:44:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 274896B0007 for ; Sun, 9 Aug 2020 16:44:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CAB8E363F for ; Sun, 9 Aug 2020 20:44:07 +0000 (UTC) X-FDA: 77132207334.27.bee52_2f1690126fd4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id A65743D663 for ; Sun, 9 Aug 2020 20:44:07 +0000 (UTC) X-HE-Tag: bee52_2f1690126fd4 X-Filterd-Recvd-Size: 4831 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Sun, 9 Aug 2020 20:44:07 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id v4so7462448ljd.0 for ; Sun, 09 Aug 2020 13:44:07 -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=uuKzMy8ewGXUSBJtIFW0KX3RN99yxbeLmlHXP4MWBpY=; b=oPiShrjiXPEdy2Cco0DaYWuVYysn0jRQlB+C7ArO0yieudE5NAPxFgcc78p6eCl6xQ eUYcIXo3hUVx6AeVpVePfK4c1s4oxxqecRJST0kCQRYovO+T6bv/0FIhNs7vbqeo8wjB EameDLmP6EniKNI0ezXFKoLzlNbtBaBOyvLrWiYI4iLyBsvrRIBQ1buAzjRdl8gRzcVF 6Q2n1w99ZlOq+QtQcheIWmvxXVovkoko4w+eKO/NrpSFYVbi0P1cF5MciP9XteH+Lbc1 SXNF/RYhb0uAEfjx1sfex+S+O2DRjg9b4+oCIGIdgJAdfKCnik70hP7mk+cjjUsUbZgb b/ZQ== 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=uuKzMy8ewGXUSBJtIFW0KX3RN99yxbeLmlHXP4MWBpY=; b=WPGyu51mirFSAmzOaooZfcSpfOkEkPC507guGBmTNAI4zHoMoyN3mEqQdC1pDJoC1V FEpwrG4iwEe+yechdGtpeNIppvCBfpMApZlTVBtkSb0jnCRW1osBqP2z6xuTzuQZnM4i PDzCwIp/xzKlDlxDf439rzZK5/p5ZPftynSpOP6iwZbyrZasM0QuOpltH5NdfMQZ+CBv hr3M9Blldey1KdY0W9UCxFaHvTVdYd38lrtvwmzAnUYWMjMIJ26db4pZHmIR96WS4uzW v5rfIdN8eNE4PhHjCyIztAlQxr1oYJjUuJ0e3rbZPMKA8cuYJ4d9fjm+sI9yt0WzYNt1 UUFQ== X-Gm-Message-State: AOAM530FbW3dYuvgpXntrMMen46B6URdA1ZCQPW2fEEtmWbL6Y0Hem44 8VXF9k3gSRnyZX1ZjTiX7rU= X-Google-Smtp-Source: ABdhPJze7IbNW/h8CDiwh7ppwJgta/7FPLU8nmFubdLHUR0XB3cjuCTYs4AdpvuvPw70SotORU6WdQ== X-Received: by 2002:a2e:8084:: with SMTP id i4mr11562182ljg.447.1597005846020; Sun, 09 Aug 2020 13:44:06 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id c17sm9529603lfr.23.2020.08.09.13.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2020 13:44:05 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: LKML , RCU , linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , "Paul E . McKenney" , Matthew Wilcox Cc: "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 2/2] rcu/tree: use __GFP_NO_LOCKS flag Date: Sun, 9 Aug 2020 22:43:54 +0200 Message-Id: <20200809204354.20137-3-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200809204354.20137-1-urezki@gmail.com> References: <20200809204354.20137-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A65743D663 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: Enter the page allocator with newly introduced __GFP_NO_LOCKS flag instead of former GFP_NOWAIT | __GFP_NOWARN sequence. Such approach address two concerns. See them below: a) If built with CONFIG_PROVE_RAW_LOCK_NESTING, the lockdep complains about violation("BUG: Invalid wait context") of the nesting rules. It does the raw_spinlock vs. spinlock nesting checks, i.e. it is not legal to acquire a spinlock_t while holding a raw_spinlock_t. Internally the kfree_rcu() uses raw_spinlock_t whereas the page allocator internally deals with spinlock_t to access to its zones. The code also can be broken from higher level of view: raw_spin_lock(&some_lock); kfree_rcu(some_pointer, some_field_offset); b) If built with CONFIG_PREEMPT_RT. Please note, in that case spinlock_t is converted into sleepable variant. Invoking the page allocator from atomic contexts leads to: "BUG: scheduling while atomic". Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 30e7e252b9e7..48cb64800108 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3327,7 +3327,7 @@ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cp= u *krcp, void *ptr) * pages are available. */ bnode =3D (struct kvfree_rcu_bulk_data *) - __get_free_page(GFP_NOWAIT | __GFP_NOWARN); + __get_free_page(__GFP_NO_LOCKS); } =20 /* Switch to emergency path. */ --=20 2.20.1