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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F23BC11F68 for ; Wed, 30 Jun 2021 12:20:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 038FF61622 for ; Wed, 30 Jun 2021 12:20:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 038FF61622 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 469998D01A3; Wed, 30 Jun 2021 08:20:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 419AF8D01A2; Wed, 30 Jun 2021 08:20:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E1458D01A3; Wed, 30 Jun 2021 08:20:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 06B288D01A2 for ; Wed, 30 Jun 2021 08:20:40 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C24A2180279A0 for ; Wed, 30 Jun 2021 12:20:40 +0000 (UTC) X-FDA: 78310298640.36.46D2C88 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf02.hostedemail.com (Postfix) with ESMTP id 64AD07001A23 for ; Wed, 30 Jun 2021 12:20:40 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 31B7321C66; Wed, 30 Jun 2021 12:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1625055639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VG8ysdAphzMD48NnpUNPVRaMSFDL1AK2ELMF+Jd0hNo=; b=efHkcfYh+ONyJoNiNOFNljrUsYc9B8aEysxqJ9DXNNtZYSbh8HQNg7cD9QWYvD2wJZFHYt wUUryX8nTGzw0pKFiKWYkE3pV4rlbIAB69hi/SS+hoXvATtk79G+wOYX7XJABLR7GsMILT jxvj4zw+RTyOBCZtDZ7YmMeR1u+VxeE= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0543CA3B8A; Wed, 30 Jun 2021 12:20:38 +0000 (UTC) Date: Wed, 30 Jun 2021 14:20:38 +0200 From: Michal Hocko To: Matthew Wilcox Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Weiner , Vladimir Davydov Subject: Re: [PATCH v3 14/18] mm/memcg: Convert mem_cgroup_move_account() to use a folio Message-ID: References: <20210630040034.1155892-1-willy@infradead.org> <20210630040034.1155892-15-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=efHkcfYh; spf=pass (imf02.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 64AD07001A23 X-Stat-Signature: c53yjrmf9zu37ed9irdih84dtm9gxdyt X-HE-Tag: 1625055640-740847 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 Wed 30-06-21 12:22:48, Matthew Wilcox wrote: > On Wed, Jun 30, 2021 at 10:30:38AM +0200, Michal Hocko wrote: > > > - if (PageAnon(page)) { > > > - if (page_mapped(page)) { > > > + if (folio_anon(folio)) { > > > + if (folio_mapped(folio)) { > > > __mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages); > > > __mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages); > > > - if (PageTransHuge(page)) { > > > + if (folio_multi(folio)) { > > > > Shouldn't be folio_transhuge? The resulting code is the same but > > folio_transhuge is more explicit and matches the THP aspect. > > I genuinely don't know. For the benefit of those reading along, the > important part of the context is: > > if (folio_mapped(folio)) { > __mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages); > __mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages); > if (folio_multi(folio)) { > __mod_lruvec_state(from_vec, NR_ANON_THPS, > -nr_pages); > __mod_lruvec_state(to_vec, NR_ANON_THPS, > nr_pages); > } > } > > We need to decide what 'NR_ANON_THPS' means in a folio-based world where > we have folios of all orders. Does it count only the number of pages > in folios >= HPAGE_PMD_SIZE? Or does it count the number of pages in > folios > PAGE_SIZE? At this stage we only have PMD based, right? I believe it would be simpler to stick with that at the moment and change that to a more generic way along with other places which need updating. Wrt. counters they do count pages so in this case this shouldn't be a problem. But we do have counters for pmd mappings and that might need some care. -- Michal Hocko SUSE Labs