Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1413606rwn; Thu, 8 Sep 2022 20:05:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7OS8BSynZTQuZZIiNzM+Z0HpCrSJHUEcI5+ZhaLuMA9G6FwEKVkL4m/k4p0y4eUWqDeGm8 X-Received: by 2002:a17:902:aa03:b0:172:9b18:ebb1 with SMTP id be3-20020a170902aa0300b001729b18ebb1mr11232716plb.24.1662692726214; Thu, 08 Sep 2022 20:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662692726; cv=none; d=google.com; s=arc-20160816; b=zgtNf8O3SYz2WvJ5N0EvUyWchlA7Yk+qJQJBFxzWAzoVhovR5GOve/uDhVYJ2i0BOS wZ8e+WAS2PPSBFgpypwBTnT+snUrKPwodZI/TIxikh4wbcCtZaNnnHChwFwtqShGaMQG Uk/T/LdPYYI+S98MVtOHYljD9WUKiAaPLG7TaRUMokuVlh1TSek0llW2fHd9Pv3ZdaKt 5QR614ES1vYPkNilsuSBCvFN2duv1kTPuv4BaY+EaZEt5bsOo2ZAPwWMykMrBfS52Au+ L6ktLYeVR5N73CGR7THKZ9forXKT2ZqrLtaydR44kY18U8EuHAZhc5pvOG4RfVKsFNYH vXvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=y9sXSthHGZ5f1Zt1Dk1XSseRcGMxGjw9uUNwvIsGKDI=; b=P2ygpDlw17q8qSlWjvI94etwDCf0nVeiShROIWOJKt8H9ifUj0X6mGJMFPwm/QSF1K YLAO4SB4KAqqUF806rtV8X6m4QUA1xNAf+BYX+btssioYFKgSpSkwINdQk7PsDcm381N H8FZqkYPQbsgJ0INPEKPLvsWvz2a0P01ebQi/CfiH7/E2aP3aZkhtwDKijWfeseemWOa RYQD9tqrjr6zXCoWiGzDgcnIIvyqy7b8zBgZ8hoMcBHro60u9T1Br4WzndrFj5Y5b7zl bvzQifNqIafD+DfIVeAGQ4VG4pxsq5ij2JCZYGAk5CgjJ82zSaHLQT3kNQggOUkWoIeJ OK+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="2mvvMyi/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a170902821300b00174fd2df917si662457pln.101.2022.09.08.20.05.13; Thu, 08 Sep 2022 20:05:26 -0700 (PDT) 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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="2mvvMyi/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbiIIC4L (ORCPT + 99 others); Thu, 8 Sep 2022 22:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbiIIC4J (ORCPT ); Thu, 8 Sep 2022 22:56:09 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69944E2909 for ; Thu, 8 Sep 2022 19:56:06 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id pj10so283102pjb.2 for ; Thu, 08 Sep 2022 19:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date; bh=y9sXSthHGZ5f1Zt1Dk1XSseRcGMxGjw9uUNwvIsGKDI=; b=2mvvMyi/o6zU9l1XeMBP8CZ2WYZ3PjBpPUURYIw2udqDtXqevpogy7SMEEO7vF2Pq7 NAozEsoicGmGag7zAZVo9vCukik1+3KTfWfh6MlTWeDH+8KxE9E7oN/TRenRXMu6owU3 uJ4i2kWK8FeI2Ecq1Rv6p5H0DZ2XQUVkPnm+5iEqeeuA3Wv8Us8BFZU0TmtbXKk/GEOt M59HU7y22WrnC4S6rHNbKCyqutGTchEKLePXuN3RkOF/TEzz/CLB3MXwOBh2co4rp+B4 TrRgLfuBWBj8NqcHZIM0fsk6dUV8c7/9BMctmrveupD9nqtc1pTs/cwDKlw8cBU+ddLM 3huw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date; bh=y9sXSthHGZ5f1Zt1Dk1XSseRcGMxGjw9uUNwvIsGKDI=; b=HletT9EIeH8+jepQ7fL9kXP+v4D3B77XaF6iG3aMJryhq0jHubIKp9DF/S4VQ/x5KZ PyM0Cbrj7kcjb/Hjvhtu4iotKlwZ3yLHZ6z+FbrizBEdLLeqdKZfrCkLqJTjP+iWrJJp 7Xm0RtpU83JRjAxG/rwP1PaoDl+xYXHn17IBul25+hZe0uukZT15VSF1duImmJcONBVy 19kbj6zlT/VSsvY/HE/ZURzDGt/Ha+gGKtX+Oun5bLC//2/truGQVsJ3ctYxaYJgXNjx IMFcV/66kPmK+G+eeBGSsrwkElWvW56QOeP8esBOBSH+xTGiuWe5qpKqUomdshHEsg0r rVhw== X-Gm-Message-State: ACgBeo1C0i86GdFuJklzJg245rY01aytpVazWqat9TQT6WR7kEWfCKLs wgsVwTPUyNU7ZFmCrbi3h0Wb1RehE9JAnw== X-Received: by 2002:a17:902:7791:b0:173:3dc2:3bb9 with SMTP id o17-20020a170902779100b001733dc23bb9mr11726542pll.153.1662692165711; Thu, 08 Sep 2022 19:56:05 -0700 (PDT) Received: from [10.4.159.81] ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id 44-20020a17090a0faf00b00200461cfa99sm2501821pjz.11.2022.09.08.19.56.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 19:56:05 -0700 (PDT) Message-ID: Date: Fri, 9 Sep 2022 10:55:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [External] Re: [PATCH] cgroup/cpuset: Add a new isolated mems.policy type. To: Michal Hocko Cc: hannes@cmpxchg.org, roman.gushchin@linux.dev, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, lizefan.x@bytedance.com, wuyun.abel@bytedance.com References: <20220904040241.1708-1-hezhongkun.hzk@bytedance.com> <0e5f380b-9201-0f56-9144-ce8449491fc8@bytedance.com> <93d76370-6c43-5560-9a5f-f76a8cc979e0@bytedance.com> From: Zhongkun He In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed 07-09-22 21:50:24, Zhongkun He wrote: > [...] >>> Do you really need to change the policy itself or only the effective >>> nodemask? Do you need any other policy than bind and preferred? >> >> Yes, we need to change the policy, not only his nodemask. we really want >> policy is interleave, and extend it to weight-interleave. >> Say something like the following >> node weight >> interleave: 0-3 1:1:1:1 default one by one >> weight-interleave: 0-3 1:2:4:6 alloc pages by weight >> (User set weight.) >> In the actual usecase, the remaining resources of each node are different, >> and the use of interleave cannot maximize the use of resources. > > OK, this seems a separate topic. It would be good to start by proposing > that new policy in isolation with the semantic description. > >> Back to the previous question. >>> The question is how to implement that with a sensible semantic. >> >> Thanks for your analysis and suggestions.It is really difficult to add >> policy directly to cgroup for the hierarchical enforcement. It would be a >> good idea to add pidfd_set_mempolicy. > > Are you going to pursue that path? > >> Also, there is a new idea. >> We can try to separate the elements of mempolicy and use them independently. >> Mempolicy has two meanings: >> nodes:which nodes to use(nodes,0-3), we can use cpuset's effective_mems >> directly. >> mode:how to use them(bind,prefer,etc). change the mode to a >> cpuset->flags,such as CS_INTERLEAVE。 >> task_struct->mems_allowed is equal to cpuset->effective_mems,which is >> hierarchical enforcement。CS_INTERLEAVE can also be updated into tasks, >> just like other flags(CS_SPREAD_PAGE). >> When a process needs to allocate memory, it can find the appropriate node to >> allocate pages according to the flag and mems_allowed. > > I am not sure I see the advantage as the mode and nodes are always > closely coupled. You cannot really have one wihtout the other. > Hi Michal, thanks for your suggestion and reply. > Are you going to pursue that path? Yes,I'll give it a try as it makes sense to modify the policy dynamically. Thanks.