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 20BE3D11704 for ; Fri, 25 Oct 2024 06:54:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BA5A6B007B; Fri, 25 Oct 2024 02:54:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 942C96B0085; Fri, 25 Oct 2024 02:54:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BBC66B0088; Fri, 25 Oct 2024 02:54:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 576016B007B for ; Fri, 25 Oct 2024 02:54:31 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E5CD2ABE9D for ; Fri, 25 Oct 2024 06:53:52 +0000 (UTC) X-FDA: 82711210092.09.976018C Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf07.hostedemail.com (Postfix) with ESMTP id 4142F4000E for ; Fri, 25 Oct 2024 06:54:02 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Uxvbddkd; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729839191; a=rsa-sha256; cv=none; b=pr1Gz4u0S84fPNzbmKyP7CgwRbl+4TU01Qm4INK0y9jK3u/veypb0nv+NCXLFFGKvOFHaW siNowqbPaDbBjFc55kPEymXkbXRbY62D2Zm3jKF9QyzAe2nVGrQzOppP+6jpCH/KL2hLS0 UgQutblp6qgPKQBTSja8ZocJ1QsoESA= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Uxvbddkd; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729839191; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=36JhFiVJEgXCmXb24IP1IdfysT56osH0yrGc0nJL9zg=; b=jcgZ3suBVC6YHYu9MxRGuT7d2WvF4VPD0MyUiiTfPjfxO2X+HqN7H0bU2ork0Lpiuu5HZk oMlxCyvwMF+RS1wq/uiFWxVGmr3WVvmpQjS38BBRv2Yjm5/4qqtf3HrrEXR5IwOhkFTn3V XMtKFOmSDhzi56FQ8aUHLYDDMklREWc= Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-431481433bdso17233865e9.3 for ; Thu, 24 Oct 2024 23:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1729839267; x=1730444067; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=36JhFiVJEgXCmXb24IP1IdfysT56osH0yrGc0nJL9zg=; b=Uxvbddkd3MeklIw449ZAId0p3iBz7xs/0F6ID7NTYVoQ9R5xqkJeN2DMp8A+sKQaki 2lDGXoIGk6jbnSBhYPuW05sC5fsvWLZOM0QDxqFQBi8O0fr34YA8UDMFLTRCXaddd2wa fFGR4UIAWxZY4cK3bHkLmUr+fgAjaa1UUaw1KpRLOaOhsgBRo0+1uRzo7gL5nNWnYQ6N 0sxZZPgZeVMRlx4+VCQMRdY8gOqk9vpMyUMMbUI7/XaHuSysNy7HbaKuAlftdYAfn+ty qWj4XpW1cH1XyeapYOKHP31psXuIs1GlxHI1l6q+yIIWH1OOqmGrhvW7rOc5HSGDTcYZ 3Y9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729839267; x=1730444067; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=36JhFiVJEgXCmXb24IP1IdfysT56osH0yrGc0nJL9zg=; b=wtyYW3AYbgKrUBRmpEXoqvdZJeAgt4CRCZv8Eb0hN0HQPRQtCWkBPxT5WKq7MdJbYj enwrAVTXZcES3jxw0F01U3yMpsZ54I7vDjH75aCUhKvbQj6BdQREc3ltg0JZJKbJ1o/a Q1Aqcp6em7kB0ZU5B4ZNgw0DEqaEnwfocF8PfqSlWjNZS+w30c44T/NcSsPOV1BdfxPG aGU6jBsEi0oNA4ntJQKAlyH1Pr8fKJ3qpeCOdaEEzTclpXTHVsBZZEnnZLtU/ih9hrlY fEUp4G5O04f761xFQU5KpIJI7+WUomqNOJOBegy+XdcrmC3V1mGuWhL7sLdkjt1HASL6 iM9Q== X-Forwarded-Encrypted: i=1; AJvYcCW4x1faf5/W4z4YURjlPnVcjbkuSGP7rHjRvs2QjKhFEPVmt0vUM9g6Cuz9tRw6rA4PiHludF98aw==@kvack.org X-Gm-Message-State: AOJu0YxtBWKPYHMY1vLKgxM1rQW52aPyJcEKiUqqFG8POW5qGVNqFCN8 4GQVOEkoKguKZNUleca3rNACclJ89TgB2Riyh6kdKAhEG/tS5X2Rt2rUOb8okIY= X-Google-Smtp-Source: AGHT+IGMMmQMryfKEZph9NzIticOCIBK+v+n5kkY2vmcHa7n5CN8sNh3ZIArtkjp3u3TtuJ4yuizww== X-Received: by 2002:a5d:5590:0:b0:37c:d2f3:b3b0 with SMTP id ffacd0b85a97d-37efcf0d877mr5764357f8f.23.1729839267500; Thu, 24 Oct 2024 23:54:27 -0700 (PDT) Received: from localhost (109-81-81-105.rct.o2.cz. [109.81.81.105]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b928cesm743877f8f.102.2024.10.24.23.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 23:54:27 -0700 (PDT) Date: Fri, 25 Oct 2024 08:54:26 +0200 From: Michal Hocko To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Roman Gushchin , Muchun Song , Hugh Dickins , Yosry Ahmed , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, Meta kernel team Subject: Re: [PATCH v1 1/6] memcg-v1: fully deprecate move_charge_at_immigrate Message-ID: References: <20241025012304.2473312-1-shakeel.butt@linux.dev> <20241025012304.2473312-2-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241025012304.2473312-2-shakeel.butt@linux.dev> X-Stat-Signature: fnw3rh5trpi7qea4pfemzpp5sw5gptdq X-Rspamd-Queue-Id: 4142F4000E X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729839242-605092 X-HE-Meta: U2FsdGVkX18b5CqQuGBH5PIqqxEtuhmcg3/a9P2xFoGTCK7XEkxvkdcxRLeU7gsyrpZ5OmKzWhg9jRliWwk0/Zqi5vKF2FcBsKQ0E8djNRp0cly//Uf0+MQx6oSsUEZCDLph4xs9MOZlWw9GMrF/MNf/m8bmkUe5o17QC0b05VQuzoCK770ihpOLlZ3ykqLbNrp73VCou/KzUhTGZ0g8o1apZ51nyDRDgNVFhJBbIHijL/R830/jLBQ/MGOfNCaqkOhOdsuOn+QTtZXrEeOA7DGQCJqvpt5AZzRJL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2XFxswm9AIMwBeOb3k+nzRR0AFqcvkosD/fVA0CxFDAIw1F0erbKmlTsdxT+AgDnkqkxs4oJSGswJWfb8MC1CvP1ObDxpLVA 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: List-Subscribe: List-Unsubscribe: On Thu 24-10-24 18:22:58, Shakeel Butt wrote: > Proceed with the complete deprecation of memcg v1's charge moving > feature. The deprecation warning has been in the kernel for almost two > years and has been ported to all stable kernel since. Now is the time to > fully deprecate this feature. > > Signed-off-by: Shakeel Butt > Reviewed-by: Roman Gushchin Acked-by: Michal Hocko Thanks! > --- > > Changes since RFC: > - Writing 0 to memory.move_charge_at_immigrate is allowed. > > .../admin-guide/cgroup-v1/memory.rst | 82 +------------------ > mm/memcontrol-v1.c | 14 +--- > 2 files changed, 5 insertions(+), 91 deletions(-) > > diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst > index 270501db9f4e..286d16fc22eb 100644 > --- a/Documentation/admin-guide/cgroup-v1/memory.rst > +++ b/Documentation/admin-guide/cgroup-v1/memory.rst > @@ -90,9 +90,7 @@ Brief summary of control files. > used. > memory.swappiness set/show swappiness parameter of vmscan > (See sysctl's vm.swappiness) > - memory.move_charge_at_immigrate set/show controls of moving charges > - This knob is deprecated and shouldn't be > - used. > + memory.move_charge_at_immigrate This knob is deprecated. > memory.oom_control set/show oom controls. > This knob is deprecated and shouldn't be > used. > @@ -243,10 +241,6 @@ behind this approach is that a cgroup that aggressively uses a shared > page will eventually get charged for it (once it is uncharged from > the cgroup that brought it in -- this will happen on memory pressure). > > -But see :ref:`section 8.2 ` when moving a > -task to another cgroup, its pages may be recharged to the new cgroup, if > -move_charge_at_immigrate has been chosen. > - > 2.4 Swap Extension > -------------------------------------- > > @@ -756,78 +750,8 @@ If we want to change this to 1G, we can at any time use:: > > THIS IS DEPRECATED! > > -It's expensive and unreliable! It's better practice to launch workload > -tasks directly from inside their target cgroup. Use dedicated workload > -cgroups to allow fine-grained policy adjustments without having to > -move physical pages between control domains. > - > -Users can move charges associated with a task along with task migration, that > -is, uncharge task's pages from the old cgroup and charge them to the new cgroup. > -This feature is not supported in !CONFIG_MMU environments because of lack of > -page tables. > - > -8.1 Interface > -------------- > - > -This feature is disabled by default. It can be enabled (and disabled again) by > -writing to memory.move_charge_at_immigrate of the destination cgroup. > - > -If you want to enable it:: > - > - # echo (some positive value) > memory.move_charge_at_immigrate > - > -.. note:: > - Each bits of move_charge_at_immigrate has its own meaning about what type > - of charges should be moved. See :ref:`section 8.2 > - ` for details. > - > -.. note:: > - Charges are moved only when you move mm->owner, in other words, > - a leader of a thread group. > - > -.. note:: > - If we cannot find enough space for the task in the destination cgroup, we > - try to make space by reclaiming memory. Task migration may fail if we > - cannot make enough space. > - > -.. note:: > - It can take several seconds if you move charges much. > - > -And if you want disable it again:: > - > - # echo 0 > memory.move_charge_at_immigrate > - > -.. _cgroup-v1-memory-movable-charges: > - > -8.2 Type of charges which can be moved > --------------------------------------- > - > -Each bit in move_charge_at_immigrate has its own meaning about what type of > -charges should be moved. But in any case, it must be noted that an account of > -a page or a swap can be moved only when it is charged to the task's current > -(old) memory cgroup. > - > -+---+--------------------------------------------------------------------------+ > -|bit| what type of charges would be moved ? | > -+===+==========================================================================+ > -| 0 | A charge of an anonymous page (or swap of it) used by the target task. | > -| | You must enable Swap Extension (see 2.4) to enable move of swap charges. | > -+---+--------------------------------------------------------------------------+ > -| 1 | A charge of file pages (normal file, tmpfs file (e.g. ipc shared memory) | > -| | and swaps of tmpfs file) mmapped by the target task. Unlike the case of | > -| | anonymous pages, file pages (and swaps) in the range mmapped by the task | > -| | will be moved even if the task hasn't done page fault, i.e. they might | > -| | not be the task's "RSS", but other task's "RSS" that maps the same file. | > -| | The mapcount of the page is ignored (the page can be moved independent | > -| | of the mapcount). You must enable Swap Extension (see 2.4) to | > -| | enable move of swap charges. | > -+---+--------------------------------------------------------------------------+ > - > -8.3 TODO > --------- > - > -- All of moving charge operations are done under cgroup_mutex. It's not good > - behavior to hold the mutex too long, so we may need some trick. > +Reading memory.move_charge_at_immigrate will always return 0 and writing > +to it will always return -EINVAL. > > 9. Memory thresholds > ==================== > diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c > index 81d8819f13cd..9b3b1a446c65 100644 > --- a/mm/memcontrol-v1.c > +++ b/mm/memcontrol-v1.c > @@ -593,29 +593,19 @@ static inline int mem_cgroup_move_swap_account(swp_entry_t entry, > static u64 mem_cgroup_move_charge_read(struct cgroup_subsys_state *css, > struct cftype *cft) > { > - return mem_cgroup_from_css(css)->move_charge_at_immigrate; > + return 0; > } > > #ifdef CONFIG_MMU > static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, > struct cftype *cft, u64 val) > { > - struct mem_cgroup *memcg = mem_cgroup_from_css(css); > - > pr_warn_once("Cgroup memory moving (move_charge_at_immigrate) is deprecated. " > "Please report your usecase to linux-mm@kvack.org if you " > "depend on this functionality.\n"); > > - if (val & ~MOVE_MASK) > + if (val != 0) > return -EINVAL; > - > - /* > - * No kind of locking is needed in here, because ->can_attach() will > - * check this value once in the beginning of the process, and then carry > - * on with stale data. This means that changes to this value will only > - * affect task migrations starting after the change. > - */ > - memcg->move_charge_at_immigrate = val; > return 0; > } > #else > -- > 2.43.5 -- Michal Hocko SUSE Labs