From patchwork Wed Feb 17 00:13:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12090777 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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 0FD96C433DB for ; Wed, 17 Feb 2021 00:13:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB4A564DFF for ; Wed, 17 Feb 2021 00:13:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB4A564DFF 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 A9ACA6B007D; Tue, 16 Feb 2021 19:13:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FCD58D000D; Tue, 16 Feb 2021 19:13:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 828966B0080; Tue, 16 Feb 2021 19:13:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 6C0936B007D for ; Tue, 16 Feb 2021 19:13:41 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 218F8180206FF for ; Wed, 17 Feb 2021 00:13:41 +0000 (UTC) X-FDA: 77825836242.19.camp49_390cc2327648 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id F02631ACC27 for ; Wed, 17 Feb 2021 00:13:40 +0000 (UTC) X-HE-Tag: camp49_390cc2327648 X-Filterd-Recvd-Size: 4234 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 00:13:40 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id kr16so359757pjb.2 for ; Tue, 16 Feb 2021 16:13:40 -0800 (PST) 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=xVcqSZcHu5IZi/C+WStQFCtrAWEjFBSbWmkdZnY1Mak=; b=jHIijN1unicXjyzPENrx3Ud1wLIwQPgTtH6laop63DTNjZ0dgJ28S5yZfj0x+h8cCM r+07GDQ1I7eTsdhnJD0/xw5YuUfEb+SeZwEWsp9ZGiiaw4COS45rwbqZ/HtjfNr+W928 Y4KHY3P2DsDcBRmJBwxHe2Bw3O5LHH2irQgkGVY/bKHwleetw3Sod4IYA9hDHuxWEgJv d4HSCLHb7GmM2kZ0BhoxN/ffzrrYxfiMY3aw5rD7qhY1+DjsY8sAyi36yBZn4xegKrRK ZcHtI8Y7vZb7jFeUBxeghGXHHL2Q88NiP5CHahtEtnzPPTnuGIvkEBT7aAA0jRDRjH4W +ZvQ== 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=xVcqSZcHu5IZi/C+WStQFCtrAWEjFBSbWmkdZnY1Mak=; b=Fha3r1hQDpUgJPP2+KM4MerpNs48Pvc2qAhDbA03EynfLmxjCkwsHCrqecFwMG3wlh 2y/ZaZ3JyHYZrO+2qMBibcVcadquTd23MDBSgIJKHkkvA9B9pTTyraSXHLaspPTMzmsD VApTPrk0UYfnAd/MOkGSgZts9Qdo8RSdAINxmqrA5WYmAt/BNTBKe2R2XYvFNoDIlxib Ehn2LMnMcLYDZg6zt5ZHfoSXC3DB7lDHu7lKBGtmZinLEgHyXJU1TKPMzdUcervRMgIq zNaPKrP0HnU3bxZucmWWXGxCYqjw/hEhO7PF5hnGfILlkq7oT2A5Mu2x3eDgUtjKccHg Ri6g== X-Gm-Message-State: AOAM530WhdRTKa021IN1VdHa3HyqQYc8jACziG8sgTcVcNrZxAqicq7b RK11NyqMvIFKOGR6vgoJYao= X-Google-Smtp-Source: ABdhPJwLfmniYH7zm8PmbGDXGY5EKEOj2yTUgjfmbch/RcW4W/iuVWi4pfuPHYaFIhnOSnFSKjOCkg== X-Received: by 2002:a17:902:20e:b029:e1:916c:a4d6 with SMTP id 14-20020a170902020eb02900e1916ca4d6mr18104plc.57.1613520819500; Tue, 16 Feb 2021 16:13:39 -0800 (PST) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id y12sm99220pjc.56.2021.02.16.16.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 16:13:38 -0800 (PST) From: Yang Shi To: guro@fb.com, ktkhai@virtuozzo.com, vbabka@suse.cz, shakeelb@google.com, david@fromorbit.com, hannes@cmpxchg.org, mhocko@suse.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v8 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu Date: Tue, 16 Feb 2021 16:13:14 -0800 Message-Id: <20210217001322.2226796-6-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210217001322.2226796-1-shy828301@gmail.com> References: <20210217001322.2226796-1-shy828301@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: Using kvfree_rcu() to free the old shrinker_maps instead of call_rcu(). We don't have to define a dedicated callback for call_rcu() anymore. Signed-off-by: Yang Shi Acked-by: Roman Gushchin Acked-by: Kirill Tkhai Reviewed-by: Shakeel Butt --- mm/vmscan.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 2e753c2516fa..c2a309acd86b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -192,11 +192,6 @@ static inline int shrinker_map_size(int nr_items) return (DIV_ROUND_UP(nr_items, BITS_PER_LONG) * sizeof(unsigned long)); } -static void free_shrinker_map_rcu(struct rcu_head *head) -{ - kvfree(container_of(head, struct memcg_shrinker_map, rcu)); -} - static int expand_one_shrinker_map(struct mem_cgroup *memcg, int size, int old_size) { @@ -219,7 +214,7 @@ static int expand_one_shrinker_map(struct mem_cgroup *memcg, memset((void *)new->map + old_size, 0, size - old_size); rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, new); - call_rcu(&old->rcu, free_shrinker_map_rcu); + kvfree_rcu(old); } return 0;