From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE7E6C54EE9 for ; Fri, 9 Sep 2022 02:56:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D55ED8D0003; Thu, 8 Sep 2022 22:56:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D062E8D0002; Thu, 8 Sep 2022 22:56:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCD7C8D0003; Thu, 8 Sep 2022 22:56:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AD3D08D0002 for ; Thu, 8 Sep 2022 22:56:08 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 648EA120444 for ; Fri, 9 Sep 2022 02:56:08 +0000 (UTC) X-FDA: 79891032816.02.56BF4FC Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf22.hostedemail.com (Postfix) with ESMTP id 2D34BC0097 for ; Fri, 9 Sep 2022 02:56:07 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id j6-20020a17090a694600b00200bba67dadso240271pjm.5 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=WEHH/sRv8GVyuGAIorBaNUcAbeNCEj/UIkjtDdf4eEdtwIeMlZG9DCiAdxuQztjHhg lGqtujNeYMWk+cLY86bLTD50nEyeiWtOyezbFL5oLftfpodMmkx9wQBR8OBGhGQsLlk7 cn7nOR77cqW2Iksr88LbD7ykxb/BIPFzjFUUjo9GRD0WHY6M73ypyK/Hup0OwYDe0hS/ 2HynjIKBLLT0rWjB2b+VvK+WQc3XWz1mquejEzbu2nI0nkE2PGQ45YHladDCMiEz21A+ 3Wier242KQqnJoSSeVIg8xT3uH4hiWXFcoUHt0Q96jyvF+JJmkv48nWqFm+MhJpEkKBe t7KA== X-Gm-Message-State: ACgBeo1lnM9LKArS2fOqKBDLLFs26uI2HQ8LvORPjJMiajlk8Mdkwggl aIP74rHP8KH4EIqkCRxHdc/RSQ== X-Google-Smtp-Source: AA6agR6RG4TKxRMoD9khjfuQrRTANMcH9NwgOzdGFd5iQJ7xz1K14X0x+gTN1m7I2VAoF75FFMespA== 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 ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="2mvvMyi/"; spf=pass (imf22.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662692168; a=rsa-sha256; cv=none; b=vG9D3km1kGP2dWfxjxeVz9pFqDARHMuXQeItIj/EcBrN6CnB753SaF2gF+tvdYGb3GS1rQ 6E8ekiT9m2fb0r8eHn8bNCO12h+6EwfSRzKW1ZDPrYF0uamkiDx1wWQXd/GM3PDNVusmPx dmT1V+d05QPp/yzge1UaUjPex0xOaAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662692168; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y9sXSthHGZ5f1Zt1Dk1XSseRcGMxGjw9uUNwvIsGKDI=; b=RA0juLWi/19jplHXkNRTcy4yGD7PwCdud+EgVPgrqdd02qaiak+hYXInuLhfP6e7I0N91a RBKGGQXhwmxnwD41R6JgN/ROPWQ4E+OfJhoWYzMb18tu7loflURlJmAWYru/MuogihnCHN FaWKxr7OcN6ItcoulF2m7xfTa4ajehU= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2D34BC0097 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="2mvvMyi/"; spf=pass (imf22.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Stat-Signature: fw3ezn5u1351umogpkxms97e8hg767hy X-Rspam-User: X-HE-Tag: 1662692167-241876 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: > 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.