Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp337186ybv; Wed, 19 Feb 2020 00:24:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxj4CJGGu0JCxFbOzcCWZXBAUB5qImrurtMduLQWDUrDmL7QynUsvWEBFPegHClI13l+OIn X-Received: by 2002:a54:4805:: with SMTP id j5mr1464229oij.29.1582100671688; Wed, 19 Feb 2020 00:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582100671; cv=none; d=google.com; s=arc-20160816; b=V8NkfE/CiG3UXD/1Es8zQhTyiEumPcPyi/dIEawasYvO0tbnUZEOMPHMoxnicrenJc 5UbGbu3OK98XS64zFGEvscaIp7cf/erFUaRFJq8yqVbELPnehCmGVsRp6d/2SuOOKEam 4aQLGLtS8zh1dplAWTy6H+RGTpJKPsTNwGYndmRP8rBlpZ0w1BghYWXLgTCtBfv949Ki sLEfgogvDckFXUhwbwzsrRaFNFUIpld/AvFAkU1UAU2CHYGWUSlFm26P0m+r/3Gb1vD7 QoqVcAjRyjPeS9EBjddxTf21dFOPPluYJK+CrtIk1LSILB4jURNtYH2ideBGnO0hFmcm 0bAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=SpTCPDiISV3M+P5VhnGqHWsLN8O1x57nqAL1309YeQk=; b=tni3Ro+sLt+KjagC4GTRala/Vg9RWLgIO+CSWjLB5W+KEaSbcB+bbWkwb8VVhtqJbQ MjQsfhwf8kyFinsYA8Akq7/ftHtcyV71ATNt/FhS5UIccr5kqM0WSS8ZoJpilWzTECQb ofOzAB+C2CELERXSa86b8hCzhU0lgVRtBXupL0Hh8TzZRSKsx+pnvgKBcAUoIfy104v3 ZaQxdOz27i+qogeoPUHon8MuEY6INr0Sz8wprEXvhKPpSFfNWuP1oT4R8B30xRGzsNwv SnkyHERZu9Sy98pXaVKRmEjcqLUj+6hjlxi2bYzSV0m8TbV75atf1nm6ZJr0Kqn4LgAt DojQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si793637otn.232.2020.02.19.00.24.18; Wed, 19 Feb 2020 00:24:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbgBSIXP (ORCPT + 99 others); Wed, 19 Feb 2020 03:23:15 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:22124 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726484AbgBSIXO (ORCPT ); Wed, 19 Feb 2020 03:23:14 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01J8JK1V002798 for ; Wed, 19 Feb 2020 03:23:13 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y8ubwtnj7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Feb 2020 03:23:13 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Feb 2020 08:23:11 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 19 Feb 2020 08:23:09 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01J8N8HO61276306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Feb 2020 08:23:08 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FE064C059; Wed, 19 Feb 2020 08:23:08 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F3444C058; Wed, 19 Feb 2020 08:23:06 +0000 (GMT) Received: from linux.ibm.com (unknown [9.148.205.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 19 Feb 2020 08:23:06 +0000 (GMT) Date: Wed, 19 Feb 2020 09:23:03 +0100 From: Mike Rapoport To: David Rientjes Cc: Andrew Morton , "Kirill A. Shutemov" , Jeremy Cline , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch 2/2] mm, thp: track fallbacks due to failed memcg charges separately References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 x-cbid: 20021908-0012-0000-0000-0000038831E3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021908-0013-0000-0000-000021C4C4BB Message-Id: <20200219082303.GA32242@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-19_02:2020-02-19,2020-02-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 clxscore=1015 malwarescore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=1 mlxscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002190061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 06:29:21PM -0800, David Rientjes wrote: > The thp_fault_fallback stat in /proc/vmstat is incremented if either the > hugepage allocation fails through the page allocator or the hugepage > charge fails through mem cgroup. > > This patch leaves this field untouched but adds a new field, > thp_fault_fallback_charge, which is incremented only when the mem cgroup > charge fails. > > This distinguishes between faults that want to be backed by hugepages but > fail due to fragmentation (or low memory conditions) and those that fail > due to mem cgroup limits. That can be used to determine the impact of > fragmentation on the system by excluding faults that failed due to memcg > usage. > > Signed-off-by: David Rientjes Reviewed-by: Mike Rapoport # Documentation > --- > v2: > - supported for shmem faults as well per Kirill > - fixed worked in documentation and commit description per Mike > > Documentation/admin-guide/mm/transhuge.rst | 5 +++++ > include/linux/vm_event_item.h | 1 + > mm/huge_memory.c | 2 ++ > mm/shmem.c | 4 +++- > mm/vmstat.c | 1 + > 5 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst > --- a/Documentation/admin-guide/mm/transhuge.rst > +++ b/Documentation/admin-guide/mm/transhuge.rst > @@ -310,6 +310,11 @@ thp_fault_fallback > is incremented if a page fault fails to allocate > a huge page and instead falls back to using small pages. > > +thp_fault_fallback_charge > + is incremented if a page fault fails to charge a huge page and > + instead falls back to using small pages even though the > + allocation was successful. > + > thp_collapse_alloc_failed > is incremented if khugepaged found a range > of pages that should be collapsed into one huge page but failed > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -73,6 +73,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > THP_FAULT_ALLOC, > THP_FAULT_FALLBACK, > + THP_FAULT_FALLBACK_CHARGE, > THP_COLLAPSE_ALLOC, > THP_COLLAPSE_ALLOC_FAILED, > THP_FILE_ALLOC, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -597,6 +597,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, > if (mem_cgroup_try_charge_delay(page, vma->vm_mm, gfp, &memcg, true)) { > put_page(page); > count_vm_event(THP_FAULT_FALLBACK); > + count_vm_event(THP_FAULT_FALLBACK_CHARGE); > return VM_FAULT_FALLBACK; > } > > @@ -1406,6 +1407,7 @@ vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd) > put_page(page); > ret |= VM_FAULT_FALLBACK; > count_vm_event(THP_FAULT_FALLBACK); > + count_vm_event(THP_FAULT_FALLBACK_CHARGE); > goto out; > } > > diff --git a/mm/shmem.c b/mm/shmem.c > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -1872,8 +1872,10 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, > error = mem_cgroup_try_charge_delay(page, charge_mm, gfp, &memcg, > PageTransHuge(page)); > if (error) { > - if (vmf && PageTransHuge(page)) > + if (vmf && PageTransHuge(page)) { > count_vm_event(THP_FAULT_FALLBACK); > + count_vm_event(THP_FAULT_FALLBACK_CHARGE); > + } > goto unacct; > } > error = shmem_add_to_page_cache(page, mapping, hindex, > diff --git a/mm/vmstat.c b/mm/vmstat.c > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1254,6 +1254,7 @@ const char * const vmstat_text[] = { > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > "thp_fault_alloc", > "thp_fault_fallback", > + "thp_fault_fallback_charge", > "thp_collapse_alloc", > "thp_collapse_alloc_failed", > "thp_file_alloc", -- Sincerely yours, Mike.