Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2067221pxb; Mon, 8 Mar 2021 13:13:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7+8ncPxR3YKmFIGsyHJYwD2Ta+mMxECQ8SwGI3BBAgXvsAEIyaYSMCHXTyCEanc5pgLiO X-Received: by 2002:a17:906:40c7:: with SMTP id a7mr16890273ejk.109.1615238029068; Mon, 08 Mar 2021 13:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615238029; cv=none; d=google.com; s=arc-20160816; b=yKelfg3D0C//4mCClhYlRQKUSlsuqdugP6meDDdI/JbBOA/6D1lDGDxWg7nKimoUBL /cslBoEQVejn5yzXOqltJvDLwczEVlTdzSSqlgHBvOTLMCEP4ixU1VR99dhUFsgvRATb 3Z/eyux2LDrfhLlmfXq9EvVBCtCpuAT7oLerVgwVqEfIVxcGWJHvUbdGibGgtaNGc4Wf I9QD7y5XJLuLEcC+8aEH0QjvZdrX7qDK2m+qdoWM8d2HWn1JhfBE4O/tO76uOk+T6rFb RTchHV3x/uTbk3uygh+EsPhwX2I/GSdeuzG60dwO5uXFL2vyAY2p74H11HtBc4d+JgnH 58Jw== 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=a5NhGk9Ze+SQuaoK4vhROcGQTDpMP/SN4w2gJyziaiY=; b=sdg3mdQoqd0G2Fjf7K2P3Bk3533k4jheGhE4iJ8TlKSAbAp+N7jB6z5j9jnkE8nuo+ oYY3DU8cuj0GsA/fIVC274NFwluC18OSVy2cqfGpwhHbOMdfblHdWb+QIM+lM8DtES09 6pUW3S9ZSzznYkBmIAVtv1efX9M5SjiqsoQS09usr74pVJpZ8WFJ0tVUO5ToYJevfQzG vYwwwc7OPw4zZhnPq9vMfzgBId6sAohvl2dVei0JsPHXy09T7cf+tbWRWcIUUJxkDsaF 4vgetdb7ObWqjBR8MOYv1DPNsP+mjujoQ2kjwlCOMnBOCm1wnkAXYrbV1JkLyVQeA/Eh rtyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QqI8pLqR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si7524765ejd.17.2021.03.08.13.13.26; Mon, 08 Mar 2021 13:13:49 -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=@google.com header.s=20161025 header.b=QqI8pLqR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231405AbhCHVMQ (ORCPT + 99 others); Mon, 8 Mar 2021 16:12:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbhCHVLv (ORCPT ); Mon, 8 Mar 2021 16:11:51 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699C1C06174A for ; Mon, 8 Mar 2021 13:11:51 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id d3so23291665lfg.10 for ; Mon, 08 Mar 2021 13:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a5NhGk9Ze+SQuaoK4vhROcGQTDpMP/SN4w2gJyziaiY=; b=QqI8pLqRynx4LJTYrKtttzBwMys2s8NV+Q05Mdn2do/eFnqWkiYXU9aAux/oSxBh00 kCtcRrWovvyfev3yY8Ax6y7EcxMeQRRLm5cWV9+wckxu+xyWHO7E62N+KFS68jkWyvC+ q6LcES7tS87j7CAWXnpsEWZJciZVVXhD8bc+6sz4GHtflsys1rX1v7g0wEUAhPTxCkEr nxIOWtyXlQIYUnMjG/JAkilvn/LeZPFaDtO8VClOeh3G1qXs1RAKEsDSorVbSUreI0+t J4nsJYoc/fpUfLXDXTEETYEs7j/Kwm0h/toueZtbyfBHdx3/vUwAczsvZXuSvAFvaypw nB1w== 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=a5NhGk9Ze+SQuaoK4vhROcGQTDpMP/SN4w2gJyziaiY=; b=fV2p689xUXgpLyXEDOD6AXLAe0Kku3vMVdfSks6UaPq1VL5Y6WIV3jZ3N+4TGoTqGO plQNQtICzEZEww4vYILn2Rvyh0MWxFGQFRg6tRsyRewkqiagBkdV/Nu7ds7xGxbIR0+2 g8ovcebRj7c1TGpQkxnJrauDUI7sjuw1l0TMV+mAy/dv2XGU1vX8JmjTEq+4cJHpyDjj I8OfQSTC0sAIuRd3NAuZGRWCi07TR8FEPNiglwktjczqJGIncPdbUQFYfD0pMSTDRWu0 2Ntbx785fOgaKXZ08SuffcdUcFV1/wNrBIg3XZmuX4qjKDIO9Jy/861uVhPX/ro7nGKY TySQ== X-Gm-Message-State: AOAM533SRk+r8fbEjuTZ+3DBtIbd+mSE5QPW4ww8Ml8jw2Q2t94wA5du DcCBsAGS7ud58/rvF4xsZaIpvl4To2dlhWUfjQ2dLw== X-Received: by 2002:a05:6512:6c6:: with SMTP id u6mr15152395lff.347.1615237909692; Mon, 08 Mar 2021 13:11:49 -0800 (PST) MIME-Version: 1.0 References: <20210217001322.2226796-1-shy828301@gmail.com> <20210217001322.2226796-6-shy828301@gmail.com> In-Reply-To: From: Shakeel Butt Date: Mon, 8 Mar 2021 13:11:35 -0800 Message-ID: Subject: Re: [v8 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu To: Yang Shi Cc: Roman Gushchin , 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 12:22 PM Yang Shi wrote: > > 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. Once you change, you can add: Reviewed-by: Shakeel Butt