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 BE04EC433EF for ; Wed, 11 May 2022 03:17:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ACFB6B0073; Tue, 10 May 2022 23:17:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25CFD8D0001; Tue, 10 May 2022 23:17:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AFAD6B0078; Tue, 10 May 2022 23:17:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EEC126B0073 for ; Tue, 10 May 2022 23:17:47 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BDE9D31962 for ; Wed, 11 May 2022 03:17:47 +0000 (UTC) X-FDA: 79452002574.07.FF5D9BE Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf30.hostedemail.com (Postfix) with ESMTP id 6D938800A5 for ; Wed, 11 May 2022 03:17:29 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id n10so973625pjh.5 for ; Tue, 10 May 2022 20:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:from:to:cc:subject:references:mime-version :content-disposition:in-reply-to; bh=aeafOzN+KhT6xUt6Ci9vzPISfyWvX+i2zyBA9FualR8=; b=mjeGKZrdMWExTOJ6nPIF/ql6gb2ybbylcxERjkn8bZkniAbu+OkCrh5PZomXGZrpa4 CyAZIcyYNW2HF13bB/wwbu5e3Bw36U7BWCWdePNlS1qBWVrwwatm6VabqeT3f4wJAX74 f5/BgNdy4+Sdo3Im6khhbbqCdAb4FfNDDIl6lM7EezVKU7aCEWIO2yhAR2P1L1HoLzTU ZjPAz4p2JhBF9H6znOW4wi8xBa1OdS7MAMM+DbDy0ayTCYCOKfm7nd6ej2fKBn61MoPe XeCCJY2JjdzZJYmI8gwKcfzJxvgd+8RnQSG+0PrjgGXJ9ybnx7vpK5WA4gD7IfKkgc0O wSkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=aeafOzN+KhT6xUt6Ci9vzPISfyWvX+i2zyBA9FualR8=; b=YpYHz5y3rgrzJyjkOGqj+NoDTz4kAv7QBDla7yQzZbdOaohdS2KRhiVgnoYFj+2qb9 9Ugrdmag5kEAd41aniNu8EztX+twlouWcC6FYeluIbEW3k6fl7Fpx3eQpDxZKRSxFgG0 0B/2kjcRqov1Tfe7QVsniNGefzHSlysZl+4X/UK68T5l9Fh3cVRU2TNAWwcGh7GcIvfj IjTnz8o/9nFhRYqnLb45Xj8HcSLvtRtfQjfKSGeSrpLms0QZebMNqgqBZUmC25xaEz3S Wzof/PR8IrMQ2m/ykLeEXr2kqzgWBg3ZEgo7fGOWcKusbxJsBoukCwiZH84Lj6Xm2pGA FNzQ== X-Gm-Message-State: AOAM5331TrTvGuM8syqUPq7nSOMTGOyFMUdxlQo6QBrksrekzjeWNvC8 hR6rmABRP9OBgO3i4Gw5HhY= X-Google-Smtp-Source: ABdhPJzuDCrXWj27Bp+TxP4Ag9W3lfCdFyaSyYAQH8xHrdDBO+s6hWJQXjFez5nZcUr36BNPHtd/6w== X-Received: by 2002:a17:90a:f310:b0:1db:effb:a614 with SMTP id ca16-20020a17090af31000b001dbeffba614mr3064928pjb.233.1652239066326; Tue, 10 May 2022 20:17:46 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id 11-20020a63184b000000b003c14af5062fsm446612pgy.71.2022.05.10.20.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 20:17:45 -0700 (PDT) Message-ID: <627b2ad9.1c69fb81.f2bc7.19d6@mx.google.com> X-Google-Original-Message-ID: <20220511031744.GA1494607@cgel.zte@gmail.com> Date: Wed, 11 May 2022 03:17:44 +0000 From: CGEL To: Shakeel Butt Cc: Yang Shi , Michal Hocko , Andrew Morton , Johannes Weiner , Matthew Wilcox , Roman Gushchin , Miaohe Lin , William Kucharski , Peter Xu , Hugh Dickins , Vlastimil Babka , Muchun Song , Suren Baghdasaryan , Linux Kernel Mailing List , Linux MM , Cgroups , Yang Yang Subject: Re: [PATCH] mm/memcg: support control THP behaviour in cgroup References: <20220505033814.103256-1-xu.xin16@zte.com.cn> <6275d3e7.1c69fb81.1d62.4504@mx.google.com> <6278fa75.1c69fb81.9c598.f794@mx.google.com> <6279c354.1c69fb81.7f6c1.15e0@mx.google.com> <627b1d39.1c69fb81.fe952.6426@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mjeGKZrd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6D938800A5 X-Rspam-User: X-Stat-Signature: by8p9stprpry8ahqzfjnhjy4h5oq9hru X-HE-Tag: 1652239049-212168 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 Tue, May 10, 2022 at 07:47:29PM -0700, Shakeel Butt wrote: > On Tue, May 10, 2022 at 7:19 PM CGEL wrote: > > > [...] > > > > > > > > > > All controls in cgroup v2 should be hierarchical. This is really > > > > > required for a proper delegation semantic. > > > > > > > > > > > > > Could we align to the semantic of /sys/fs/cgroup/memory.swappiness? > > > > Some distributions like Ubuntu is still using cgroup v1. > > > > > > Other than enable flag, how would you handle the defrag flag > > > hierarchically? It is much more complicated. > > > > Refer to memory.swappiness for cgroup, this new interface better be independent. > > Let me give my 0.02. I buy the use-case of Admin restricting THPs to > low priority jobs but I don't think memory controller is the right > place to enforce that policy. Michal gave one way (prctl()) to enforce > that policy. Have you explored the BPF way to enforce this policy? Thanks! prctl()(at least for the latest version) only support disable THP, it's semantic is not very perfection. Maybe we could expand the prctl() for THP? BPF maybe a way to realize more fine-grained THP control. But I think semantic comes first. So what about realize three layers of THP controller? All kinds of users maybe satisfy: Layer 1: all system, realized. see /sys/kernel/mm/transparent_hugepage/enabled. Layer 2: container/cgroup, unrealized. useful for user who treat container as lightweight virtual machine, let this overide layer 1. Layer 3: process, partial realized. see prctl(), let this overide layer 1 & 2.