Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp936734pxj; Fri, 21 May 2021 02:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWD3EypHtQ1amABg+mpr6d8ReEsFZfUO3d7mQNaX4Oil9t/uQR6bKtglzNe/IQBCZFrDAs X-Received: by 2002:a5d:9644:: with SMTP id d4mr10576536ios.84.1621589930709; Fri, 21 May 2021 02:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621589930; cv=none; d=google.com; s=arc-20160816; b=j9mVlvwiyvVkgVJjlTR3oGOsYOcOrr5MhkPG7ggVUkYaVUncrm1dI+i34URriA846G EJe5VRKFff997pTzhhntSyGpY+2rfKWHcIVJnQaxHkB/HtRtYqS9lgRWhBd5lPpjBvo1 jrFF83wnfWi5yLSbatihf7MplDjpRhlQk6zEmry+Ih8KB6VCrRcQLQsTOm6JIj93FcYV UPJSvWwFsWtDN5xXzrODlcnuZtcBtuOahFQ4v8fu2T9AAVKawsNtqQhX04QP1ut5SxCV 8/nJCRXknd3493N7b+SMf1cJ5OvXwUAsQafCRq22akLMjLnb+LHgYw0Jm/9X5Mn4Wz08 mOtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=nRdrmoruGBD9VAJhucB/jrSZL64FsyhxNZPuWFU+1sI=; b=mLFPwPqyAyJWxsg+zwUrrF155O3S1b0M2VijdoCiHieVgo/L+VPKwIjEBtIsfCyp7m SQ0zqK0KShNblPwiY8oYFcLltzs2Rb8ed+p2n/S4KJX98mUoXZ2Yj3jnPDBMjAJI7XCh PEtXxSgDk3iW1i2jmF3+SRNWuieErFDjjdPpOr3tozeto5gzBZxYU/Qz5VuVmDLaXUCo 0gj/Q03unxGxTg0Iqkt1yxG6UqWZT8sm68HhKQZY4PL8iuQ57gVkJ6w/q2cY7NJdlDeG tz+AMXbFtp8R69+53OMgnioTkwiuSb+kBPSRdly854vcXTAG1q9dsBkiMdAZHptbpyR3 mrPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si5078451jas.72.2021.05.21.02.38.37; Fri, 21 May 2021 02:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235677AbhEUES4 (ORCPT + 99 others); Fri, 21 May 2021 00:18:56 -0400 Received: from foss.arm.com ([217.140.110.172]:37490 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231337AbhEUESz (ORCPT ); Fri, 21 May 2021 00:18:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E6828101E; Thu, 20 May 2021 21:17:32 -0700 (PDT) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5F2E3F719; Thu, 20 May 2021 21:17:30 -0700 (PDT) Subject: Re: [PATCH] mm/thp: Update mm_struct's MM_ANONPAGES stat for huge zero pages To: Hugh Dickins Cc: Andrew Morton , Zi Yan , Yang Shi , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1621313300-1118-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <8fa7fea6-4176-32fd-2c6a-abb6b73d0d13@arm.com> Date: Fri, 21 May 2021 09:48:11 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/21/21 7:47 AM, Hugh Dickins wrote: > On Tue, 18 May 2021, Anshuman Khandual wrote: > >> Although the zero huge page is being shared across various processes, each >> mapping needs to update its mm_struct's MM_ANONPAGES stat by HPAGE_PMD_NR >> to be consistent. This just updates the stats in set_huge_zero_page() after >> the mapping gets created and in zap_huge_pmd() when mapping gets destroyed. >> >> Cc: Andrew Morton >> Cc: Zi Yan >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual > > NAK. > > For consistency with what? In the all the years that the huge zero page Huge zero page after all is an anon mapping. Hence why it must not be counted for process rss MM_ANONPAGES accounting ? Is there a specific reason why zero huge pages should not counted for MM_ANONPAGES ? Does not it risk an inaccurate MM_ANONPAGES accounting for the processes using huge zero pages ? > has existed, it has been intentionally exempted from rss accounting: > consistent with the small zero page, which itself has always been > intentionally exempted from rss accounting. In fact, that's a good part Why are small zero pages exempted from rss accounting which in turn might have caused huge zero page to take the same approach as well ? > of the reason the huge zero page was introduced (see 4a6c1297268c). Huge zero page reduces memory consumption on read faults which is a definite advantage but would there be a problem if rss stat goes up for each huge zero page mapping instances. The commit mentioned here talks about increase in actual memory utilization as seen from the rss accounting stat, without huge zero page usage. I am wondering if actual memory usage remains the same (reduced with huge zero page usage), what could be the problem in an increased MM_ANONPAGES accounting for a given process. Dont we update the rss accounting for shared memory as well ? > > To change that now will break any users depending on it. Just to understand it correctly, are rss accounting procedures/methods something which cannot be changed as users are currently dependent on it ? OR this proposal here is not a good enough reason to change it ? > > Not to mention the > BUG: Bad rss-counter state mm:00000000aa61ef82 type:MM_ANONPAGES val:512 > I just got from mmotm. Okay, unfortunately some how did not see this problem while testing. Is there a specific test case which will be able to trigger this bug ? - Anshuman