From patchwork Mon Mar 30 02:32:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 11464475 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 646BD13A4 for ; Mon, 30 Mar 2020 02:33:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3214F2078B for ; Mon, 30 Mar 2020 02:33:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="YFyChil3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3214F2078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6A8296B0070; Sun, 29 Mar 2020 22:33:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 632826B0071; Sun, 29 Mar 2020 22:33:38 -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 4D3B56B0072; Sun, 29 Mar 2020 22:33:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 32FD06B0070 for ; Sun, 29 Mar 2020 22:33:38 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3B3BD45AA for ; Mon, 30 Mar 2020 02:33:38 +0000 (UTC) X-FDA: 76650457716.06.shake80_59edc0e83a500 X-Spam-Summary: 2,0,0,da35d940eca32d75,d41d8cd98f00b204,joel@joelfernandes.org,,RULES_HIT:41:69:355:379:541:800:960:965:966:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1542:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3872:3874:4321:4385:4390:4395:4419:4605:5007:6261:6653:6742:7514:7576:7903:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13894:13972:14096:14181:14394:14721:21080:21444:21451:21627:21990:30054,0,RBL:209.85.160.195:@joelfernandes.org:.lbl8.mailshell.net-66.100.201.201 62.2.0.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: shake80_59edc0e83a500 X-Filterd-Recvd-Size: 5205 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Mar 2020 02:33:37 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id m33so13931999qtb.3 for ; Sun, 29 Mar 2020 19:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y9juYIZdTD4S3/RhfF4ZU+wi+6D+Bwupgtb3fIEkI74=; b=YFyChil3lVYm7zhnne5lGhwbXXlq2EDvxsIxZFa2dtN2ItcId/sHvPqThGAh1BwFZl YWaCpA7Lt+GVmGROOWIIkfAFa//fAZAdJmSr8bHVwVDtlP8Ncb6wNX3k7OmivGSl7CnM qCJmFAVk90alncCE3ob/Cy9tUBPO6k+bzjjzU= 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=Y9juYIZdTD4S3/RhfF4ZU+wi+6D+Bwupgtb3fIEkI74=; b=eDrCAMYPpTnVmCNglkdyM+665rD4Wrdgnc4YzEjEmmxBOkXgnlbxoaJXJ2kRgyeheo Ym3AdwyYd64Qt+sruHz9njuT5Z9YLkAmUFYOrh+k23RwlDRz0m8s7QliHVP6Y22JCgNi JDAuz7bAkCvhdp1m0sNJTJ9c7ZMbkjxekFoiGS0owg2UCVcMXEEqIIS2GyuW9mqcmjI7 EsZL2icqzT4GabWHWXgr/YTCOsr5HNB3zfO04JviYfeSTE8UBhqXnKAkEw6war1D9gU7 1dmteDpxSjIaeiK33HAddKUYdQd1jUBANCsWJuZGd6BWp/FkYbFAIahAf+D0Iwqi/xam FvBQ== X-Gm-Message-State: ANhLgQ1Iy/iLdHawxq9jDQ8lJ5bxBeOs7S7VMxLfWTVg8zCya3TlW9Tp HGv42JdHixC8Qbfb76vsNwv44g== X-Google-Smtp-Source: ADFU+vscGt7vUJpfCtGgJZKczUSOnNkYu/OpdYETeb8x0PKQDoRTASn4p6B5qpZSy87hhDabIXEibQ== X-Received: by 2002:ac8:6d19:: with SMTP id o25mr10223186qtt.303.1585535617018; Sun, 29 Mar 2020 19:33:37 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id q15sm10030625qtj.83.2020.03.29.19.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 19:33:36 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Uladzislau Rezki (Sony)" , Joel Fernandes , Andrew Morton , Ingo Molnar , Josh Triplett , Lai Jiangshan , linux-mm@kvack.org, Mathieu Desnoyers , "Paul E. McKenney" , "Rafael J. Wysocki" , rcu@vger.kernel.org, Steven Rostedt Subject: [PATCH 06/18] mm/list_lru.c: Remove kvfree_rcu_local() function Date: Sun, 29 Mar 2020 22:32:36 -0400 Message-Id: <20200330023248.164994-7-joel@joelfernandes.org> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog In-Reply-To: <20200330023248.164994-1-joel@joelfernandes.org> References: <20200330023248.164994-1-joel@joelfernandes.org> 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: "Uladzislau Rezki (Sony)" Since there is newly introduced kvfree_rcu() API, there is no need in queuing and using call_rcu() to kvfree() an object after the GP. Remove kvfree_rcu_local() function and replace call_rcu() by new kvfree_rcu() API that does the same but in more efficient way. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) --- mm/list_lru.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/mm/list_lru.c b/mm/list_lru.c index 386424688f805..69becdb224080 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "slab.h" #ifdef CONFIG_MEMCG_KMEM @@ -383,21 +384,13 @@ static void memcg_destroy_list_lru_node(struct list_lru_node *nlru) struct list_lru_memcg *memcg_lrus; /* * This is called when shrinker has already been unregistered, - * and nobody can use it. So, there is no need to use kvfree_rcu_local(). + * and nobody can use it. So, there is no need to use kvfree_rcu(). */ memcg_lrus = rcu_dereference_protected(nlru->memcg_lrus, true); __memcg_destroy_list_lru_node(memcg_lrus, 0, memcg_nr_cache_ids); kvfree(memcg_lrus); } -static void kvfree_rcu_local(struct rcu_head *head) -{ - struct list_lru_memcg *mlru; - - mlru = container_of(head, struct list_lru_memcg, rcu); - kvfree(mlru); -} - static int memcg_update_list_lru_node(struct list_lru_node *nlru, int old_size, int new_size) { @@ -429,7 +422,7 @@ static int memcg_update_list_lru_node(struct list_lru_node *nlru, rcu_assign_pointer(nlru->memcg_lrus, new); spin_unlock_irq(&nlru->lock); - call_rcu(&old->rcu, kvfree_rcu_local); + kvfree_rcu(old, rcu); return 0; }