Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2833369rdb; Wed, 4 Oct 2023 12:53:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzwcO4FhZEQam3NUMg3oOhrt5JKQcDRZ/wGbxmEXPW2CrA1htd2JYk5VCtQ3m+fsGOcnsq X-Received: by 2002:a05:6358:528f:b0:143:96ac:96ec with SMTP id g15-20020a056358528f00b0014396ac96ecmr4269807rwa.25.1696449208812; Wed, 04 Oct 2023 12:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696449208; cv=none; d=google.com; s=arc-20160816; b=mumLHAtzbLxyWzt/NWBCvtHxOXP7q3tUv72TxNaSAF20UW30YpW6DufsvEwIRUSC3o 3AwA7xyl+aLmIlaaOamtlgQH7HLiydnpcuLm1aK/VugEqhXoELHcv07ppx15mJWhyskK jQfkugfANjP3Phaul3hF2G6ePCycQ66taW90DKxOJoX7NQblOhmb/sm8I68WnYWD7l5V 7dlZ0vryHZ/bou7MqE+4FbSI9ZE3BKZBAQhaqb9+mvyf+dR6tKtrdZr4pENm7eDj74EJ Yp4jAXpnlUd3ToEsEmOxgi/7NGWhZxOubFgJf0YjDqC6aI7sgChT7XPiR+yrTvAi673w MqtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=miM9Rii6r7WYSuGpAV4z/io68HUwHuAXAnsLamrRpmw=; fh=4R5i4hyIt3oGEN7bw4DomywUPx9oaoQNztRc26zGBRY=; b=RqGvoCMWAnD7RzPLSVY4hVxaUjgzc6swHcxowRX4iiIHsUvd0AVsUQSE9nKz7vgiLP 8Rmwz0Nu79YwioCFRPA819RNT92i/4AS8WAlPa/P6T1Oxj5EQPill4i4RM6i7/ZTdVeP pIpIno9K+Hgl34oPwMNkCkUyS5Jh/2M7b11r7D6685vABDC05k8i+r0UxuNaz4+nepZV ghRhTRPG8QENwYmiRDg7NMUijv8J9pXj4cQ9SgrdeFoA4L/mZaHijfETRJWMoAENVTtu Vh4VT2ZuUri0rhZ57zluXBISeR0Bn3WQl7OMr5DYdPqPau5WiY6cTmUr7GbXNB08NMYZ Xu0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cgP+U1NM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m125-20020a633f83000000b00577f87e6210si4406831pga.332.2023.10.04.12.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:53:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cgP+U1NM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EC46481F3418; Wed, 4 Oct 2023 12:53:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243903AbjJDTxS (ORCPT + 99 others); Wed, 4 Oct 2023 15:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233573AbjJDTxR (ORCPT ); Wed, 4 Oct 2023 15:53:17 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33FF0A6; Wed, 4 Oct 2023 12:53:14 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-79faba5fe12so9543339f.3; Wed, 04 Oct 2023 12:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696449193; x=1697053993; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=miM9Rii6r7WYSuGpAV4z/io68HUwHuAXAnsLamrRpmw=; b=cgP+U1NMOp+xBRSQ6pPNS81Oj1VumE05K202Q8rW57F7NtsY9XiNUm7QulMYgbhyeQ PB7AQIzXnvd+blaAZhTAezIUwovwqJof8N71VedIIXKB50bhVnlCzIYSDCG6nbhsWGk7 F729pgGeT8QinwCrGwZVUXFNXHOYNa22iyvlONy32ncyA9cfWljP1IlGlmc0VTwYUjFy CAihzSeVtqS1eW+n9x0iM7iNCecowD/z6p6fQS22HyXiiATqvYnUeo0AbLL834vhxKS5 TO7ZHbcHQx9RBr0LRjFstFOPXdAo7ElVYp6ZF+HewwBDJyxVXBZnR/v6AAaU8xuGkfAc rt1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696449193; x=1697053993; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=miM9Rii6r7WYSuGpAV4z/io68HUwHuAXAnsLamrRpmw=; b=Ggd+gmD8hbl+IwvGSwU6+cA22rbY1iTENOKO5xFutl2wDgLBAQLArwR6d55Zkt6yty Euf8iIB0EEwhEPuvoyA65IBjXxOZxP0uIjv6eyyF8cHveg7TStN6hsMdNSNIA7JSx7DI 0syIs+vyNmQHwGmtLEqcwtqzXo7dz+mCN+sTFg6VgEBKZz/CR0awAw7egcHRZEyrIay3 kSdfc1gCazUSKdpvgTDGU9cwjgobTeZMJyhXXXGTFF6N06jfLbv7BDx3RAjmdu43GXSl TH8y0uiiyL76sB/qTQgDoiEAACMZRtXZM1PK3RBmr0UHg1Bm61yqtGlxDIY2XWITpu/A hR7A== X-Gm-Message-State: AOJu0Yz+BJxERnMdhKIPaOBGp10Ufr94t3mz5ehe+j68C2yxJuGjm6CW 9uSHRjT6tWkYoAUTSQ3qeuTYkO5++erRIhqo3sY= X-Received: by 2002:a5d:9943:0:b0:79f:d194:d6e2 with SMTP id v3-20020a5d9943000000b0079fd194d6e2mr3780651ios.10.1696449193517; Wed, 04 Oct 2023 12:53:13 -0700 (PDT) MIME-Version: 1.0 References: <20231004193622.900383-1-nphamcs@gmail.com> <20231004194630.GC39112@cmpxchg.org> In-Reply-To: <20231004194630.GC39112@cmpxchg.org> From: Nhat Pham Date: Wed, 4 Oct 2023 12:53:02 -0700 Message-ID: Subject: Re: [PATCH v2] memcontrol: only transfer the memcg data for migration To: Johannes Weiner 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 12:53:26 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 4, 2023 at 12:46=E2=80=AFPM Johannes Weiner wrote: > > 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 ol= d > > 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 Thanks for the review, Johannes!