Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2040217pxb; Mon, 8 Mar 2021 12:26:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLivGZGX1wdHIKOQ3O9ifxmfHAYF47tHu/bWLUO0Z7L3cvnILVDXV2smJG2/xi8qEvj1bS X-Received: by 2002:a50:fd83:: with SMTP id o3mr400714edt.90.1615235188082; Mon, 08 Mar 2021 12:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615235188; cv=none; d=google.com; s=arc-20160816; b=tDsMZTp/52LnaIxnE24WurwIEOhoZqwV4VF8N1R5aDrwJk9WG1MMpTmtLT3uEROyEs yFhHcNzdLC9/uD+EPZNNEJiR/vvXsHLJFGBZjNGVHBIaUI7thUoqpG1Pqr6Dc7rSgQEL tTTMHX3xEg9F0Q54+E85QpkvjlCQnYuqKVLKcEIEXk9RuVpEPpM0zpgsQunXiVp4dJ4F W8PK6HHztsOkzPKcSxxNsRqJ/PxKiFPYu/xqMcJiaOsQQrYWMQI8Ye4rYr5Ml/c4KXpk j6AwvfaR5LX2Zq82qSTugG1fShuZjqmBU4BJ7EdBvaffGBAAsVAHCA9V6s8EWPeDG3IB XH6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3p1K7qixRZDMiRKjRkwZnb9DrzcEb8jXcbBFm53rg9s=; b=aJh4zVJqGwyxH37cZYdyw1fzoZbpOAR5DP5kUA/w/BlVLx8o9mf0cgdpwnbW+3sekj NA5yrxRtTc9LF0HRMncNtHsrv3GbQaiT4rH6f1vPW+3LYlcmcb3CpQm4823jwUd/jpMj FPHNvQ5yvzgbq3vE5fpZcVn4P0nkrxmbC+MNbIINH3WLt18WqENRZZHByw/j8r+h6M5c bVNyloHWEgNXDlSBqtmq5uMDz69fMcoopps+tloAxProuTbvjG9IILxFLLLRV/hJle9B 5SKzpSZMgwSuNoXgNWMhwdSIrGa4tw5newnN3RAsR+Ri4zuZVjd7RV1Jipa8XeQ+1kiU sG+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Caln3dMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x27si7305047ejb.603.2021.03.08.12.26.05; Mon, 08 Mar 2021 12:26:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Caln3dMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbhCHUW4 (ORCPT + 99 others); Mon, 8 Mar 2021 15:22:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230097AbhCHUWd (ORCPT ); Mon, 8 Mar 2021 15:22:33 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D0FC06174A; Mon, 8 Mar 2021 12:22:33 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id m9so16649831edd.5; Mon, 08 Mar 2021 12:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3p1K7qixRZDMiRKjRkwZnb9DrzcEb8jXcbBFm53rg9s=; b=Caln3dMvsxXDLD71Ze56UjGJP3p+B/XeWTIG8AYVUOuupr1rf1sJw1TIqhfR59BNZF 3HyEP9un1YcjnDN7H7aNTIq4yv1s/RY+zFF25Akb/W334PqjR+VFZD4A1kYOmzLVNVV4 s9ER+BzJUHFPwnuePf/jfuPlHPW3S+51L3RtuSawnNe+roneB9K+1mDIkuc7FP4jre/7 jPSIhyyC3o11Gica68KKnO7LGbw5lHpYZTgPVfV67B5gu4YITK8ikiFR27oj4GcgMImS uZKCHayfX9zATHeBQ8yCHiqpFBpgw7v+p1/tta6COdbfrz8mPpRoMPtJ5DkCZqq1KXj4 Q/Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3p1K7qixRZDMiRKjRkwZnb9DrzcEb8jXcbBFm53rg9s=; b=QR3bXqlQn8NyLaHympsnsNvU7TmPL4m6QLG3DHFybqYgpDkPnQJIyUGNqxR2MtGbcA BiDePHYNMqRBU4MDF1ZxVV5eILQKG4K86fLSBskaW388IrgF88eHdNb/INarlf2j6Ebx Vng0I/tKVEtvuwErU14mE1kl2WmrQLAZmZTySGbQn8/RM9VKDwugmEU6tIcam/sSoeeC Q+Lhch7Iq/U5uAetR6HwGJP0J4drotRM9hkGBjOa+edKKUcD/ovK0TmnVstl+YpK+N9H WT3hERfQCv8RTkXCJHA/dU0qmNf+3H3qj+lhZh064zS5+cPGX3TvqnnXGYdJGlwyyPdP hQWQ== X-Gm-Message-State: AOAM5301T7LrkhFDtJG4oy1X7ua/g6c/jmc1mciJ64aGGXnPe7aVZJU1 LU/+4ew18m7JeQlRprpSHapT7QsbOxAehFyBV+U= X-Received: by 2002:a50:8f42:: with SMTP id 60mr363572edy.168.1615234952188; Mon, 08 Mar 2021 12:22:32 -0800 (PST) MIME-Version: 1.0 References: <20210217001322.2226796-1-shy828301@gmail.com> <20210217001322.2226796-6-shy828301@gmail.com> In-Reply-To: From: Yang Shi Date: Mon, 8 Mar 2021 12:22:20 -0800 Message-ID: Subject: Re: [v8 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu To: Roman Gushchin Cc: Shakeel Butt , paulmck@kernel.org, Kirill Tkhai , Vlastimil Babka , Dave Chinner , Johannes Weiner , Michal Hocko , Andrew Morton , Linux MM , linux-fsdevel , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 8, 2021 at 8:49 AM Roman Gushchin wrote: > > On Sun, Mar 07, 2021 at 10:13:04PM -0800, Shakeel Butt wrote: > > On Tue, Feb 16, 2021 at 4:13 PM Yang Shi wrote: > > > > > > 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 > > > --- > > > 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); > > > > Please use kvfree_rcu(old, rcu) instead of kvfree_rcu(old). The single > > param can call synchronize_rcu(). > > Oh, I didn't know about this difference. Thank you for noticing! BTW, I think I could keep you and Kirill's acked-by with this change (using two params form kvfree_rcu) since the change seems trivial.