From patchwork Thu Mar 11 19:08:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12132529 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,URIBL_BLOCKED, 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 843FBC433DB for ; Thu, 11 Mar 2021 19:09:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1493064EBB for ; Thu, 11 Mar 2021 19:09:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1493064EBB 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 1E4108D02EB; Thu, 11 Mar 2021 14:09:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 172EC8D02B2; Thu, 11 Mar 2021 14:09:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB4E28D02EB; Thu, 11 Mar 2021 14:09:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id C545C8D02B2 for ; Thu, 11 Mar 2021 14:09:16 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8A4162C1E for ; Thu, 11 Mar 2021 19:09:16 +0000 (UTC) X-FDA: 77908531512.16.B6C08FE Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf03.hostedemail.com (Postfix) with ESMTP id B30C5C0007D2 for ; Thu, 11 Mar 2021 19:09:08 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id mz6-20020a17090b3786b02900c16cb41d63so9831522pjb.2 for ; Thu, 11 Mar 2021 11:09:10 -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=uVGBdCD7D46KwnzDeHFbJFDsSaALpjrd7Gd+gGd1rXE=; b=LeRQjwnw2LeCRF7BgliFeq65y5FqMfUxpySNgLPB8dqZdAbhQXJ40f0eFMxW9ZtgGG E0PyIWo7ZNLhtfEW2BvloPIVyyCGRi+eJE5NS1W9uxh8vnnaGPDGH3tWoMIsh5z4AQTm hxSr5rUUO7S4wWeYBcp826RkRVHHQk6oSA3g706vUAtBpGUQVwgQoWexRVWjLYArFBiI OginCWSvf/ZVJjz1oYD6mFaQp/CuFxViPEO1jemusmUawvrw12sNUWHgWyw46IV8UU7q x08rY9hN+i8bF6OlEQF1ItrcygFnRzH2Q0KW/19CbdnCl0MlSTw+tZVmt9AczdOCx6xl KY3g== 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=uVGBdCD7D46KwnzDeHFbJFDsSaALpjrd7Gd+gGd1rXE=; b=Y+XyIxw1f/mwlq+LZxZBOVMwYV357u6o/8mTv7qNPybZ5xHw3joBD7DRDuZKra2sgK jTmkQKsw6W0uXk+ej2DMD9XF3UcPw+XezhkJhn+438ZYTvpN3f8z9rAR5es5R5YJ7pFR jByjKj4vSwMWnn7J/lO0JfgDFyQjgZRxwb+mp6DWaFAKPsA1QaE/ursKT/9IVgQMpG+9 SpdfcDYTgu5H7Miw2VDSreRY7lfWLDI5ey0bK6pY9NQm1j7VCB5CSYailvSMFBT5DubC BX7m9DvBpZlDJYR5deDlIS0o76Vn0FeIBZT1ja/N+WXbZ6i/KeS7WPNQ7IvSny3DfxeG rJjw== X-Gm-Message-State: AOAM533Ryuk1SYgm5CwjI+IgsMFuMDaycTk8+65mp1UePuedIR77jle4 qQedm3Pze/iIEcPs0JZvM4c= X-Google-Smtp-Source: ABdhPJzDjGg0JWVU4rrN0/JBFOTry3IxyIysSN54EZUh/VsTJfCbQjf4QVKvcXFG8sZ5SEY6RKN2Pg== X-Received: by 2002:a17:90a:540c:: with SMTP id z12mr9963872pjh.163.1615489750107; Thu, 11 Mar 2021 11:09:10 -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 t12sm2999111pfe.203.2021.03.11.11.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 11:09:09 -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: [v10 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu Date: Thu, 11 Mar 2021 11:08:37 -0800 Message-Id: <20210311190845.9708-6-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210311190845.9708-1-shy828301@gmail.com> References: <20210311190845.9708-1-shy828301@gmail.com> MIME-Version: 1.0 X-Stat-Signature: ezz9wzu6zpnfh9t7catrnchzb6efhsd4 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B30C5C0007D2 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mail-pj1-f51.google.com; client-ip=209.85.216.51 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615489748-780628 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. Acked-by: Roman Gushchin Acked-by: Kirill Tkhai Reviewed-by: Shakeel Butt Signed-off-by: Yang Shi --- mm/vmscan.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 641a0b8b4ea9..bbe13985ae05 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) { @@ -220,7 +215,7 @@ static int expand_one_shrinker_map(struct mem_cgroup *memcg, memset((void *)new->map + old_size, 0, size - old_size); rcu_assign_pointer(pn->shrinker_map, new); - call_rcu(&old->rcu, free_shrinker_map_rcu); + kvfree_rcu(old, rcu); } return 0;