Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2830579rdb; Wed, 4 Oct 2023 12:46:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpuTZcK2YASGIdN5Le+7zb48Wab8i8i6iw3oDvrbxg5qRsVGWus+Iq+6X4oH9XgW3I9UTR X-Received: by 2002:a17:903:2585:b0:1c7:29eb:3b9e with SMTP id jb5-20020a170903258500b001c729eb3b9emr2426033plb.2.1696448811253; Wed, 04 Oct 2023 12:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696448811; cv=none; d=google.com; s=arc-20160816; b=kOyfXEn+jyOpAghNRdzqJWE3xFKCTHPQj21JRL/t4tXkGnjuIkpjRRM+xy91hk6+GC PNFKQg31wDEbtInTRemlr7WGpv7yGfHIx08I1nOZsaJ09qVfsOrx2VyeHAoIfqctRLDI TcPmy8NwptIjSn0R2n3nwfhjwfviFNOokWDECgI/5y2WNr3czGuix+cWDhT1L7kLp1hg qG1iGmnROH+wF8N0JXEiVkd06nTr3tICQUW37bWmsil+RHPGuyiumuFSW3A7uFn2XxdZ FHzHHXNtNKjpbLFZnCd7L5P1ByhPzLsQu8BTpy2EG0uYSHcy++M5DSWttsvN1KFX2iJg mVyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u7a74Jso/OlkSlZMDwvvLmtQIl8s2lVAx0+yVbpXmMU=; fh=I/uh0PLt0Q7SD9oWHjfcRZzfVY85hnSkD2A9C1cdbOI=; b=cV9sKHkiOxDgVCBcTVrS9sYovZqoFL8PqNtPDezXDqM+yE/YLEDZUeIsM7kDc08UD4 6pdIWEPdlDv6FN2/rvG8TFclKxzxn9nZBK9/O6IcIQ+2xz7Gk0Z9bdznhdhGPRrBw2oX 1HPg3NiKOXKFuskFepl5WcoseWpOwbTKEkDPNu88uUk5Yf7rJFhxfcc18kjZc7jiS7JT 8LmcDe6p8BIEt3Z6JP8X0vnsC8ljOPXCtiDWyqgunQMAIIxiWLD2cWt2eh3N4EGv05Vn JM2X7wastZEbU37Cw3KLiarbjzLsd+UF+33T7ebA9Qaq4z25s2Iyb2UsMwDTBCNtxouZ 5Cjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=08N+s2VQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id s2-20020a170902c64200b001be025f8407si4094739pls.37.2023.10.04.12.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=08N+s2VQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B2BDD81B5A9E; Wed, 4 Oct 2023 12:46:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233573AbjJDTqh (ORCPT + 99 others); Wed, 4 Oct 2023 15:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233505AbjJDTqg (ORCPT ); Wed, 4 Oct 2023 15:46:36 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D23C19E for ; Wed, 4 Oct 2023 12:46:32 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-4194c3cf04aso1109211cf.3 for ; Wed, 04 Oct 2023 12:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1696448792; x=1697053592; darn=vger.kernel.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=u7a74Jso/OlkSlZMDwvvLmtQIl8s2lVAx0+yVbpXmMU=; b=08N+s2VQamUz9NrNZ34dGxGDlzaxioQHhaad2PYisk4GK1jWMLT71dWA429mcBBrjm nxh6UMuuhI1jz8g1/87aOiLNc9mbDxTa+t4+H22tHEHklaL8L9v2kbdqvynZAAz8sid3 EVOJj1YM9KyD7CC8WmqeOJUet4Iu8Gva7CWWYMhTyalfAKSLSFC5vJgGf8R6xtam0a3f 3Uu+TcbwyuxWBnFeHhkJvqpNMpNFYM0rkJ+u3cwxwo3dgKMJmf+HbdTYUA2UAka8SMYR BIp15X8Lefdai7ZMt9/UV7SUFcqKDlViipsZ7O6ZZn+EqLZR7VJfW3kzUQqoikgG1Doy 5tKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696448792; x=1697053592; 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=u7a74Jso/OlkSlZMDwvvLmtQIl8s2lVAx0+yVbpXmMU=; b=ZdB9I6uCeBIR1Co/p6bQ1+2g9hppaaWNZXBa3IKsXOL0fjrbRUtXS67jTR7yzS7dxQ yiKfjMFsCfih64k2bWZKJXTW209ALRcq3ddIvfFHSgMP9ybgnWU2UL3Hv/NSJgyTqlNb e/AM03cn+wxtmO12HPGwy0LtVo9e2RpVodPenk2fvJCNmUzn2PnZABKbw3CMBf1H/Yl8 AY6cv+4TvpzupfNxoh7VWNsEr8AYhTj5umkmLyYMvRJ3ml9zGIGijK1MxCAPgyddS7gN Kab7g8FxuFPKlCAbxQOGiG0Sfvh/ktYayavSXuiyJjd3BkPALm2xz+5AZbPFP5UnNzsN DiOw== X-Gm-Message-State: AOJu0YwLbkiTNBncnlGJOdZOzjOj8rYK3a8JXOki8n5INfsX41QhgojR cZtIRkosRBV16jUNeJflsmX13Q== X-Received: by 2002:a05:622a:84:b0:417:a469:1680 with SMTP id o4-20020a05622a008400b00417a4691680mr3713256qtw.38.1696448791933; Wed, 04 Oct 2023 12:46:31 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:753d]) by smtp.gmail.com with ESMTPSA id jr10-20020a05622a800a00b00403ff38d855sm1440504qtb.4.2023.10.04.12.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:46:31 -0700 (PDT) Date: Wed, 4 Oct 2023 15:46:30 -0400 From: Johannes Weiner To: Nhat Pham Cc: akpm@linux-foundation.org, riel@surriel.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com, shuah@kernel.org, mike.kravetz@oracle.com, yosryahmed@google.com, fvdl@google.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2] memcontrol: only transfer the memcg data for migration Message-ID: <20231004194630.GC39112@cmpxchg.org> References: <20231004193622.900383-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004193622.900383-1-nphamcs@gmail.com> X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 12:46:48 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 04, 2023 at 12:36:22PM -0700, Nhat Pham wrote: > For most migration use cases, only transfer the memcg data from the old > folio to the new folio, and clear the old folio's memcg data. No > charging and uncharging will be done. > > This shaves off some work on the migration path, and avoids the > temporary double charging of a folio during its migration. > > The only exception is replace_page_cache_folio(), which will use the old > mem_cgroup_migrate() (now renamed to mem_cgroup_replace_folio). In that > context, the isolation of the old page isn't quite as thorough as with > migration, so we cannot use our new implementation directly. > > This patch is the result of the following discussion on the new hugetlb > memcg accounting behavior: > > https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/ > > This should be added as the second prep patch in the following series: > https://lore.kernel.org/all/20231003001828.2554080-1-nphamcs@gmail.com/ > (hugetlb memcg accounting) > > and should go right before the following patch: > hugetlb: memcg: account hugetlb-backed memory in memory controller > > Reported-by: Mike Kravetz > Closes: https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/ These two tags shouldn't be here, but in the fixlet instead. This is the dependency patch. Otherwise looks good to me: > Suggested-by: Johannes Weiner > Signed-off-by: Nhat Pham Acked-by: Johannes Weiner