Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2067139rwb; Fri, 19 Aug 2022 14:44:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR6mwUaoS9UK2JThRUlfoYhNRWSmINO5u52W3PdPCGXO/Qlf+eYwFMwLNgZUZmJl7Bjv5XCd X-Received: by 2002:a17:90b:4c07:b0:1f5:40a:8040 with SMTP id na7-20020a17090b4c0700b001f5040a8040mr15946813pjb.121.1660945458592; Fri, 19 Aug 2022 14:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660945458; cv=none; d=google.com; s=arc-20160816; b=mrJzAZlTWmV6u5fQ2N5+C63NaJ/AjbFFFMaoXjZw8iukyXyIpf80PK/h/UgUfn3AcQ lrhWZ1mjp+XqcBKFzK4xVl/XOhjtr0X5yR8XLEUVLt6bldcPIbuDAUEJKpEGHPV2h65y xXaIsAnFh3O68GhUXPdxONriRvFNWotWNni+hZjosuk+YksW5A1sQB75A4JHnFRD29zT 5Ume1d0W3wkC5w2noDk3vgGkb6kopv7UaNNo16UXPmFgedUKrHe8mVyCVpcJP7J69Y4b 04opGNT6HQvhoxHt48yMVxs92lno5WFl2iuFoUNvWPZLdqY+PCDy33F8IGF3PCA1ZX6/ ff9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=426wMCJsiGTV85lu42+JZPwXusrFJ9i/3rufNlqDqLk=; b=hYJ0EOTobenwtKrMXDhzym3W1v1x8DazFfMK3ZpWfGZkkjn6o5uG3jOtEWbDlIr26A yAkc9sKUvVtL094gyUefSpqu6/uwXbBSIzvacmduszXWI1Hl4yEnrARVbsEnEMt5agwy 46403kQ91UMVU4vdwJN+QhkOjUs2VKAh5GSwywLlYpYm5GpRrdGGcbHgfYY0wq1wYn4b kyqKeJQJfMdOQa7dSP+Jkb2CPc3sHBvMfCtzKQbkd3QUR/k+2AV2ouCQF8R/RCWawbZu HKRTahmK1kZOgT17sPx/CLmIBqkeAg358I3o7/gr2QfPipKfMoCTQCkQPl9qbuJ/3Quc AFJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Zf0eIAQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170903234400b0016360b6cec1si5204928plh.230.2022.08.19.14.44.07; Fri, 19 Aug 2022 14:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Zf0eIAQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351846AbiHSUth (ORCPT + 99 others); Fri, 19 Aug 2022 16:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351575AbiHSUtS (ORCPT ); Fri, 19 Aug 2022 16:49:18 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA603B7EFE for ; Fri, 19 Aug 2022 13:49:10 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id c5so3774658qvt.11 for ; Fri, 19 Aug 2022 13:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=426wMCJsiGTV85lu42+JZPwXusrFJ9i/3rufNlqDqLk=; b=Zf0eIAQmZsTmWin33rp1mlGvqcz+m2sPSmH3oNADGIUsHoKnVEiH9xF+s1jb97xCiO J0knpuEdwimm+Im9nIVGP8G1P07+5I5eQ4bVNmf31TVrIf/xuxXXdRoMQb4VbNXObzhg F0hJq6xJ6mrwwj1riPdTvVJnS5dP5eb/go24s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=426wMCJsiGTV85lu42+JZPwXusrFJ9i/3rufNlqDqLk=; b=mMyVFdDCT8F6vZJyClGOdiuZgPDgOh0ksdrusEPm6zffqTcsThLqr3qOYgcqlgEr79 SzdS3OlLtTnSOFAsXDePhPvkcNQZ5+L7JTrVVGoYgX9Q6lyylps5g5baiaEawduR4b7O UuShLF7aWDlMyBWo9Y8CDmnMWYHb/jJdC20RO096SKCPaGkqrtUEieSE8pbuLr99SfEj 1Ux7Ho2zanAvzrqB3J+BNI0pSwBGdcayx/Dq+CGovuHU5iTT0N49N2SWobQsthmcSWSx Vggcj6mQM5YbFF6J2eZnKpMBtY3ozyCVEy2WNHw3fVZvKyrvw1cBGacJTOXlNfggly+K VJaw== X-Gm-Message-State: ACgBeo3aBH93KjlK8DLOhvZWAo1NnxjYCkS2Ug5Tx28RGa7mGAzdpB+X 4s171fI9OnRDFbYFQcyvDT6l/Orz5MFJdw== X-Received: by 2002:a0c:8ecc:0:b0:473:2fa4:df7c with SMTP id y12-20020a0c8ecc000000b004732fa4df7cmr7842135qvb.55.1660942149873; Fri, 19 Aug 2022 13:49:09 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id x8-20020a05620a258800b006b9a89d408csm4377123qko.100.2022.08.19.13.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 13:49:09 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , paulmck@kernel.org, Rushikesh S Kadam , "Uladzislau Rezki (Sony)" , Neeraj upadhyay , Frederic Weisbecker , Steven Rostedt , rcu , vineeth@bitbyteword.org Subject: [PATCH v4 08/14] security: Move call_rcu() to call_rcu_lazy() Date: Fri, 19 Aug 2022 20:48:51 +0000 Message-Id: <20220819204857.3066329-9-joel@joelfernandes.org> X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog In-Reply-To: <20220819204857.3066329-1-joel@joelfernandes.org> References: <20220819204857.3066329-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is required to prevent callbacks triggering RCU machinery too quickly and too often, which adds more power to the system. Signed-off-by: Joel Fernandes (Google) --- security/security.c | 2 +- security/selinux/avc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/security/security.c b/security/security.c index ea7163c20751..d76f4951b2bd 100644 --- a/security/security.c +++ b/security/security.c @@ -1053,7 +1053,7 @@ void security_inode_free(struct inode *inode) * The inode will be freed after the RCU grace period too. */ if (inode->i_security) - call_rcu((struct rcu_head *)inode->i_security, + call_rcu_lazy((struct rcu_head *)inode->i_security, inode_free_by_rcu); } diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 9a43af0ebd7d..381f046d820f 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -442,7 +442,7 @@ static void avc_node_free(struct rcu_head *rhead) static void avc_node_delete(struct selinux_avc *avc, struct avc_node *node) { hlist_del_rcu(&node->list); - call_rcu(&node->rhead, avc_node_free); + call_rcu_lazy(&node->rhead, avc_node_free); atomic_dec(&avc->avc_cache.active_nodes); } @@ -458,7 +458,7 @@ static void avc_node_replace(struct selinux_avc *avc, struct avc_node *new, struct avc_node *old) { hlist_replace_rcu(&old->list, &new->list); - call_rcu(&old->rhead, avc_node_free); + call_rcu_lazy(&old->rhead, avc_node_free); atomic_dec(&avc->avc_cache.active_nodes); } -- 2.37.2.609.g9ff673ca1a-goog