Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1722660rwb; Thu, 1 Dec 2022 23:34:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5kyeIBEK7TVuAMvMbQOKCCaW9gIAWOWPKXSOEqfL1BeGRUv2toJlfsX4D/w+BFHdCQ5EV7 X-Received: by 2002:a17:906:4309:b0:78d:36d7:92ae with SMTP id j9-20020a170906430900b0078d36d792aemr43313376ejm.113.1669966493040; Thu, 01 Dec 2022 23:34:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669966493; cv=none; d=google.com; s=arc-20160816; b=UMi/bNhBRjWLc6va8D5SUUv3KtF9Qo/RD+S1HcmNwPylXy9U3y9xRjWOXhNUtz/Rmk PvQ3bp867+18cRTdaL18B8mZGGCaQV+v5WaWZ+bQh2EfhFIkRZRqp8xEfnA/tAjXz/m4 fCfc+hMgKDeJD7/iSBf9o96qys9dQdr/agPjyc7O2tfwl1OkmIi/5oviZyE6g5fZr+Pw 1YijowHRS68F6M6F81ffOHu2qK1nldyUEDssatCvbTCiI/CORTuS0oGkILlCknuCfkXo rAo/WNadxooNrubz6xJ0wWWLbq2SH5xi04Lfnl7mzXQ7F55vunEIZ1Aw3e+T0OBFvKnG l3BA== 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=Te7nlf3tgyUNylw2aLfROy5KSdSnYYCg2lheu+/mNdA=; b=zpBsY9tUBiTo6Cc3/EIHhKcvr8s1/aXjBBm6h4pwAwDJHPYGjY8ThDsObvJq8WS/H2 co3QnFTTISrctNG+Kjmon7MgwXQWiL3qgvlCkV7likkXqgwTJt/gBfVClnSskXmwEfYR lvQL2PuxtCM6SeqDhdtDpF0L/KBYaCQUS18MNLLOphtVg8d9uZUfudW5KDrh1vRT6Rtm oXo2QzhgWWBN7YXYWEkjxBhrJMuApW1BBqu2YxAqkLKrXSOcOsHtzLFGIizamcmoh5EH HZ6guIOrtKHARckKKpCCDyIPkxLqKV4TqY859/dMMZ6+af683hkvm45IHl0848tH3rHw fRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Art8F8H5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a1709066d5500b007adeb7f8e5bsi4485536ejt.913.2022.12.01.23.34.31; Thu, 01 Dec 2022 23:34:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Art8F8H5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232011AbiLBGZJ (ORCPT + 82 others); Fri, 2 Dec 2022 01:25:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbiLBGYu (ORCPT ); Fri, 2 Dec 2022 01:24:50 -0500 Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B21B98543 for ; Thu, 1 Dec 2022 22:24:26 -0800 (PST) Received: by mail-vs1-xe2c.google.com with SMTP id 125so3758803vsi.9 for ; Thu, 01 Dec 2022 22:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Te7nlf3tgyUNylw2aLfROy5KSdSnYYCg2lheu+/mNdA=; b=Art8F8H5odERe6K4OJ3za/Tpr9HcQMtpyUw+7q20j9n80APvjUKLAAlCGf1PtUSU2X Nc6j/6jRvymlfAU/yUZQbQCrW/qVUZa6Wfl8kaPO2RHQe5gbo7mi5RM7qWIZuFUVop/U g86j/y5PvFCJz08peZHJF2OKYM8EGbJrv7R0Ah8CW8xACEEFrLXA18RhzmSGzhijdNr0 JZCPDK8PyDAMZOWOrbKygSFcoALwbQzlQu4LgBXoNVfdgnEY8zgoDKsexwFDTrw8Aff2 X6n0ewZAndF6JrFPEh/du/7DLAQ0hqZb+9wk4dCFJbWMcIXW5LA9PmPbkMTSKQBIpNbh M5Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Te7nlf3tgyUNylw2aLfROy5KSdSnYYCg2lheu+/mNdA=; b=Zgfm+xrk7FtPRxHwtUJqDc/nYw9TkQyGGdjzhCGlebgBA/kT1ziyUuoz2Yv33T3zRW 4GnX7OxJRq6ZwoIzVUjJ3mg8lNceezOeqJJmF8KVpfuUjLf/S5D2aWbZJraNN9vmDnnw spiOG3Sgn8mlNYdQvQ79Woawge9WnrzxML1Eni0WmU2zr+y8BrvmaZCoiZngsEqLfxWG 9cLZ8gJs6suoyrOirLSFqjiqWQCvFQ3jqkNFjCb5ljFmvlDcShUDyDre6J3bCj6yCjei EwNqlUCG5S7BrsMlGdFk7I4kA4KrDyxOvGSliTCItr0c2itV6nou2nNIhcaU7s2N0KjT E/qg== X-Gm-Message-State: ANoB5pn/qAe5RYvYmjnVCpx4vV9uTft5b8OSbY/fWIJYt3LQU5X1W4PB 8XZ3SM3IhdAG3/4FHy7w9Mffn5Un29zyIdFi+KtW1Q== X-Received: by 2002:a05:6102:2758:b0:3b1:1962:24f9 with SMTP id p24-20020a056102275800b003b1196224f9mr395682vsu.72.1669962265514; Thu, 01 Dec 2022 22:24:25 -0800 (PST) MIME-Version: 1.0 References: <20221130020328.1009347-1-almasrymina@google.com> <20221201213202.ycdaymwojd5plyrk@google.com> In-Reply-To: From: Mina Almasry Date: Thu, 1 Dec 2022 22:24:14 -0800 Message-ID: Subject: Re: [RFC PATCH v2] mm: Add nodes= arg to memory.reclaim To: Muchun Song Cc: Shakeel Butt , Huang Ying , Yang Shi , Yosry Ahmed , Tim Chen , weixugc@google.com, gthelen@google.com, fvdl@google.com, Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , cgroups@vger.kernel.org, Linux Doc Mailing List , linux-kernel@vger.kernel.org, Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 1, 2022 at 10:05 PM Muchun Song wrote: > > > > > On Dec 2, 2022, at 06:10, Mina Almasry wrote: > > > > On Thu, Dec 1, 2022 at 1:32 PM Shakeel Butt wrote: > >> > >> On Tue, Nov 29, 2022 at 06:03:27PM -0800, Mina Almasry wrote: > >> [...] > >>> diff --git a/mm/vmscan.c b/mm/vmscan.c > >>> index 7b8e8e43806b..23fc5b523764 100644 > >>> --- a/mm/vmscan.c > >>> +++ b/mm/vmscan.c > >>> @@ -6735,7 +6735,8 @@ unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, > >>> unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, > >>> unsigned long nr_pages, > >>> gfp_t gfp_mask, > >>> - unsigned int reclaim_options) > >>> + unsigned int reclaim_options, > >>> + nodemask_t nodemask) > >> > >> Can you please make this parameter a nodemask_t* and pass NULL instead > >> of NODE_MASK_ALL? > > > > Thank you very much for the review. I sure can in the next version. To > > be honest I thought about that and made the parameter nodemask_t > > because I thought the call sites would be more readable. I.e. this: > > > > try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL, > > MEMCG_RECLAIM_MAY_SWAP, NODE_MASK_ALL); > > nodemask_t is an array, which can be large depending on CONFIG_NODES_SHIFT. > I don't think passing a big array is an efficient way. So I agree with Shakeel. > Ah, yes, I think the nodemask_t ends up compiling to something like: typedef struct { unsigned long name[BITS_TO_LONGS(MAX_NUMNODES)] } nodemask_t; If it was an array it would be passed by reference anway, but I think if it is a struct containing an array the array will get copied indeed. Sure, I will fix in the next version. > Thanks. > > > > > Would be more readable than this: > > > > try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL, > > MEMCG_RECLAIM_MAY_SWAP, NULL); > > > > But the tradeoff is that the callers need include/linux/nodemask.h. > > But yes I can fix in the next version. > > >