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 7CD8FE8FDC0 for ; Tue, 3 Oct 2023 23:54:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EDB88D00A2; Tue, 3 Oct 2023 19:54:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 076F08D0003; Tue, 3 Oct 2023 19:54:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E32608D00A2; Tue, 3 Oct 2023 19:54:57 -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 CEF7D8D0003 for ; Tue, 3 Oct 2023 19:54:57 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A27F71A04A0 for ; Tue, 3 Oct 2023 23:54:57 +0000 (UTC) X-FDA: 81305808234.20.77DBECB Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf23.hostedemail.com (Postfix) with ESMTP id CBA99140019 for ; Tue, 3 Oct 2023 23:54:55 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hI0xtSW7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696377295; 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=k54IfXN35LcUb/U9aVzVxuRpliN0wT/CBLBw3Ki+e6g=; b=e29kbmhw51sji1a6QwnMkzFPp7PX/pI3rMTqFvibHKmtnRfaWsWeSBB7wGzVAOuCbS7wV/ kBlCmrvbiAVmdCE8kwe6I25Y5KGTd+IzLkdMRac3Kq+YFvKtl2e/uSTtEkIsyCawSOP3kk Ggc0eQMWeQg2TQGCvzFTSITajn6zQeo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hI0xtSW7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696377295; a=rsa-sha256; cv=none; b=5xo+iB34PDWxlsiBKnh/MnnVGySjhfvYuSLpPEYvirx//diD3AaQ3Wgsl8hahe4yukwAlU 7ptN3YKRwoM/1RVqmpn5kQqW5os1A4e9I9kkAwyCQfW2HCBssrmNF0WERDgy+9CzKIfduM Taexaq7aDC6P6YQBsegJZSzB52yY4c0= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-9b29186e20aso263182566b.2 for ; Tue, 03 Oct 2023 16:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696377294; x=1696982094; darn=kvack.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=k54IfXN35LcUb/U9aVzVxuRpliN0wT/CBLBw3Ki+e6g=; b=hI0xtSW7pmToY1Jr7tzC7nfL8aF+ZX0DJ/5eesSaKtxLg1s97Ni1dIKu/dmwU7pyqU yO1mE83/yoUP6jaiv3v7lUe+ih+mzcvMKpxHBC0pMhAWgBOwdffIybP861fvVC52eXz3 bh6biHMAHW1qr7Dfep0zLhqGJS0Brglhj/5HD1UhISj+UDojcdmQT2tm7K+2g8dHUGu3 CRlcrUqBS2lhN15yjIh+ONXTC5gx7A98CbwEge+qnDFmUA4wu4thHSFxv2r2bUG1oqHc Mye2O4yNBlpeUIZTW3gr+82qmC/SomZAkvhNPLbjHen9tcLd9CsSxKt4A2dWjQRFnzCy ApDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696377294; x=1696982094; 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=k54IfXN35LcUb/U9aVzVxuRpliN0wT/CBLBw3Ki+e6g=; b=FwlG4/imu12HeNJjNEzxrKJ3KtXNEyG2s3tCdjLu5iIoo2FCdmp6yRoA4q0DzJ0tiG 30TtK6zLoFgkffbux/p+JzGQ7lxQEzis6jSeYH7V+bNFGUmrHzxR+muUdOj26vfomiMt nmTAqBl9daw9YPLkfVTTxp75mdVIlEEoEYzUSyf9io7aqF/LQo+1HpsmFjQWEXeKubCD D3QtzzKFD6d+p/1uHw+ZL73Iam+G/7/BLuQcYxxryg/KjLRHZVn1Y+TzMP3Uti7hydcz fTYAFrkdEUmy19f1yQaHjB3MwmmMvhL6gXdTuKoVVeEuGyU4GoSIcUt5wpHhSw/A29PZ Ih0w== X-Gm-Message-State: AOJu0Yy2E78Lrvl2fF6YbLoQUE53knn6wzj9B0GpaPa8CEiwbC7AqRd0 j1FwP+K3kce/aKELyKMIq9kq6eeRv4qf1d/jvPLfyQ== X-Google-Smtp-Source: AGHT+IHmQjFNjfE4KL0F3yD6xfaY0FGO07TXSsUtsgVYU7mnvWYnWoqjBjIa9c7vbuKv8yTPBRBoymK2iIyTF9qIovE= X-Received: by 2002:a17:906:9c1:b0:9b2:89ec:d701 with SMTP id r1-20020a17090609c100b009b289ecd701mr654707eje.27.1696377294256; Tue, 03 Oct 2023 16:54:54 -0700 (PDT) MIME-Version: 1.0 References: <20231003171329.GB314430@monkey> <20231003231422.4046187-1-nphamcs@gmail.com> In-Reply-To: From: Yosry Ahmed Date: Tue, 3 Oct 2023 16:54:14 -0700 Message-ID: Subject: Re: [PATCH] memcontrol: only transfer the memcg data for migration To: Nhat Pham Cc: akpm@linux-foundation.org, riel@surriel.com, hannes@cmpxchg.org, 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, 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CBA99140019 X-Stat-Signature: x7ep9jmh8mdwradhk5qmnsdmuefkdjut X-Rspam-User: X-HE-Tag: 1696377295-185993 X-HE-Meta: U2FsdGVkX1829KW2gXQ/gDF6LCG+qk2M+aQMKqEUcN85fxeTjEnAhJxdFhP3dJsc2kcIbhl8/Gpdd2nP0Zztyfe6EY7JfaUCkGIuEm4AvIehyQStwo1L5OA8otHvDRn9Gyo48fdbqCjFVZVzCOCWFwzzvsSHYzJYsVO3dxdK/8QjY3X2I1oLpJM4wf5REDGfgXEi+E+Iotyn15g5OL0ettoKfI+Jp5LHjixHi6qqXkuhMpKxkFl+PvqIfLf2kdN+fyTmagpvoSt8QxzUWWGSySDq5gNgWtfXZzhGAXkLpMaug+RlgG36ZwhYaS9Bf7gxx77vLqJADKLfo45agj0qYyLogdtJT8lr/h44ZKWu2/SWVC3tbMoqUgUqBg4Ey7ZgJNDWBV1OhuD0JWHj+OZrjz7q+7LUrs/Dermy/1M67zf2HAVcbSb+QcCsr/nQnMeRkKmDsmFQc6bNdi95DPHD1tFjcu8nIjLjaBFqlaTw2xXxHhpZvXbbGrRCAERx5IiBKHyLNtsmGR4AxRsyHJIB2+29G4UVZCez+HHFHDK8xUWGzGajVsVQyY2TDCVuqkhMpRAC6rYUL2/b8KInoEswQsQoPTwnyIE7m3h/kUFm9Qmra8Tgb+830bLQXXyOhhGyruVKvmxq4V+UFO/6atST9wT3AlgQ49ZYXwXgiMY9ImpoV1m1CMBCjwAEHYVmIjPPuODcGplPNejXr9Fsz13Ir80fN3RKom4KGwP8QU9HOby84yABcSNI6PAfH2lhLvL8SJlPxfMmg5X+BIxs2DJSM16duMysEYWtCnZ1BpsoLohS9vG/9WXRuyjJTPTLbOz1I0jukKyp6wBI2lfv8kiraN3UZPfV40Gf32kJEIbP06HO8ue9UHwmLjkR29n1yTmnALDWNK3sA5W21UyDyWX7pt2pX0SKEK6JjnCjksPSn0DszH0gY0xfUSZDiZefU4gSiW7Pna3nY9yls28BKrY rlJd8RpV lxFA/pBuzvMLyajwcouqaOYA1h09lDJ0iK/z1NqoG/N+007sOzerp9K2UyFqFJUDd89fYevk7fbcKf0iCAORDpxemZ4uGBs9H4/SaI9WZVhIyW2AOaI4FsVOiHQZY8syMDS/ewp+K/LabC1IyGvW/ApLUtNFcUOyWUpQJoPXxHDSAG24TPpeVg/EZfqEmIhF5J3Y+MV2vIqy7Q0qPiXnHBjvGw/J1tyPaP9sDqDDFn2j0KyVnEdUHXY0x3PI1Fzgt6Jjft7kzUfWeDTZya8QdqtmEMqmiUKwGmlVRURmSvJd3lIbPxTLiXJFHrAGUkSAV+QOR/riyOrsOmohmH8LE65uVwgnGrOIFkqNhumSCV9XbQYHUHhmge99ofsRT9peXAg7N6FYlRKMk9k6A0B7kWYEZaZLL+t6NHIoT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000700, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 3, 2023 at 4:31=E2=80=AFPM Nhat Pham wrote: > > On Tue, Oct 3, 2023 at 4:22=E2=80=AFPM Yosry Ahmed wrote: > > > > On Tue, Oct 3, 2023 at 4:14=E2=80=AFPM Nhat Pham wr= ote: > > > > > > For most migration use cases, only transfer the memcg data from the o= ld > > > folio to the new folio, and clear the old folio's memcg data. No > > > charging and uncharging will be done. These use cases include the new > > > hugetlb memcg accounting behavior (which was not previously handled). > > > > > > 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 th= at > > > context, the isolation of the old page isn't quite as thorough as wit= h > > > migration, so we cannot use our new implementation directly. > > > > > > This patch is the result of the following discussion on the new huget= lb > > > memcg accounting behavior: > > > > > > https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/ > > > > > > Reported-by: Mike Kravetz > > > Closes: https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/ > > > Suggested-by: Johannes Weiner > > > Signed-off-by: Nhat Pham > > > > Does this patch fit before or after your series? In both cases I think > > there might be a problem for bisectability. > > Hmm my intention for this patch is as a fixlet. > (i.e it should be eventually squashed to the second patch of that series)= . > I just include the extra context on the fixlet for review purposes. > > My apologies - should have been much clearer. > (Perhaps I should just send out v4 at this point?) > It's really up to Andrew, just make it clear what the intention is. Thanks!