From patchwork Wed Mar 10 17:45:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12128819 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 EF344C433DB for ; Wed, 10 Mar 2021 17:46:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 96CA464F1D for ; Wed, 10 Mar 2021 17:46:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96CA464F1D 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 D0FCC8D01E5; Wed, 10 Mar 2021 12:46:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CE7978D01D5; Wed, 10 Mar 2021 12:46:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B60CD8D01E5; Wed, 10 Mar 2021 12:46:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 9526C8D01D5 for ; Wed, 10 Mar 2021 12:46:26 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4DFE41809CA52 for ; Wed, 10 Mar 2021 17:46:26 +0000 (UTC) X-FDA: 77904693972.04.F20E63F Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf12.hostedemail.com (Postfix) with ESMTP id 4CADD238F for ; Wed, 10 Mar 2021 17:46:22 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id l7so12607553pfd.3 for ; Wed, 10 Mar 2021 09:46:25 -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=wWUIbkbeLDVeoKhz04HlwT305yWIUKH2N08ijUlQ/LU=; b=RQpXtzHP6YLnQC3J09daZ1GQ7Qy/ODQBOv6H7Z+LvqIS0e7lDgCcOoaNdrznD3roDt uXG/8UkhVivBJ8R+uu0pyD7qtpuNK+1eCaa6UEA6Dzcjetx7RIE67JyTSZ5xtx4/XZAU FsggF8rrvj+qXONgVtNy+LbbkKjX4JqcNtC1AwMVW1WyLWzJ1tA/UMRQDyKyU6Wkv6od UAHFvYXXOHo5zV6UlRE6sFxrR4vBxmNfqGqIXhBGwvWO5CU2ru8uApAI5iX6vp0N6pAM PoV6D18R+RvVz7ohociHFzTV3UkHctNUy3+zaK2C1vtCMH1hSL3WSRx8n/2PEdMrs/Ve 6WwQ== 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=wWUIbkbeLDVeoKhz04HlwT305yWIUKH2N08ijUlQ/LU=; b=TuTVBGb9fHTCd8s1VrJ6oOldinDDdsq7CTXA2Dxe/bPWHlmZ026OJO/N8a+YWBLnyD 7FQjaZkBE0ZW2doXH+Qcwx/Te+O6/bIfucFR2G+7nEt2aEBiPNtvoh+iTNfO5Yvy4Amy f1mB/A81XLIpMxrkgtGjGkK3Ro4LnHSme8ch7HvG/DgEwdYjcVGJw+zMcbKBmPezzUor QQgJ2vsls84tY0Z1mz4E0HboUgllYuQd+Mj5iIidXIk7QKLLIpTcP1o/DPO6xTtOfkvv 29Go1phX1AX6lrVQOnd+7R/XjpygXdAdOxJxuguGNfhhmXuIBH9u7Vtq1HRHvAIOURb+ P2tg== X-Gm-Message-State: AOAM532Sr+b/0JlHRHHfiZhjjwk5MwUDhR5nypGCLJFDR7u9CFNyD/C9 +J2vkF2RNuOISRISiPvVyIg= X-Google-Smtp-Source: ABdhPJwG6polu59DK+rBm2AeJddhoqFoysCxyy7Lndk7oMONee3tmfH81DaB99JjMA4u3gQUliU3Dg== X-Received: by 2002:a63:c84a:: with SMTP id l10mr3724168pgi.159.1615398385023; Wed, 10 Mar 2021 09:46:25 -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 d6sm145804pfq.109.2021.03.10.09.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 09:46:24 -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: [v9 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu Date: Wed, 10 Mar 2021 09:45:55 -0800 Message-Id: <20210310174603.5093-6-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310174603.5093-1-shy828301@gmail.com> References: <20210310174603.5093-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4CADD238F X-Stat-Signature: tigyic7jebfir49a85jky975b6qpzdb7 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from=""; helo=mail-pf1-f182.google.com; client-ip=209.85.210.182 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615398382-647451 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 bda67e1ac84b..c9898e66011e 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, rcu); } return 0;