Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5665107ybv; Tue, 18 Feb 2020 01:34:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyZfrpNkwgpQ7n6/jljh3DaOTYgQSQ5Uy2PFZAn5/JXer8F4jqp8xBsg/Oo6XZf+zIjU92N X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr15877808otp.346.1582018488406; Tue, 18 Feb 2020 01:34:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582018488; cv=none; d=google.com; s=arc-20160816; b=cpBQopgOQjjeCToobWj3Azf3KXuM1FJVyiGiaXCV+Ur1cjhnhTg9BQJouh3SsmWThU ZGmGLDcrKJj7hd7pe1x4BdUIe/WDHmoZ2rIBBFmeiibEHC9Ht11xAHyjbnTZJHdIYT6U CT6a1s7Cve7OKO4BnuYTA0XPVuKJiNbK3foRfkM19PMxHy0KzrIfRU+BFBVOYLEFjbnR 0t4cshyFfBx33gZo01GTg36eHmYGL8X5p72BFZ24CiEpuxNVo0+VasrVE3DRHtqNHD0c C16a4gIanI+Zo7RxHG5JKWMe74ygQC0NMmvR65YDeRLCj57CLCIywRwSQdIIcFT0XnaX qvQg== 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=pxA9Btxrgk/TFmysIB+ShqcTTBulmMGm+I4kdMcYv5k=; b=fUAvOslGz1nkyvlsXfrwlLGDxYwnu7t6RY1PswhIqvsdFWhOPRKWgRC4CsYwwZJA2W PoEPweuENLDF9u6W16o3iIZcmXY0tDKsivo9SSaXLBFiPGLtD2tIC0mJ5GSV+e4B4f5s 7lDs4/s0dFGJ8WF81oo7So5rX6W4F7wEf6YZvrA+tUbBdFdFk3XW2b6ZGhtZLcgsdgJp 7OcupFcd+W6ULHm1rlLySUtW6duTU0B+di6yem/oDr7kkrGrczr9h5q4jBdY8OSXHy9c zPTHTVHisw6kYdCAqFMIiw7o3ISRDqOFKziJekzids826hZyPVNpJnzu5KFn/2GIBZvK /ctw== 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 x26si1513403otk.325.2020.02.18.01.34.35; Tue, 18 Feb 2020 01:34:48 -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 S1726402AbgBRJe0 (ORCPT + 99 others); Tue, 18 Feb 2020 04:34:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:2018 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgBRJe0 (ORCPT ); Tue, 18 Feb 2020 04:34:26 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01I9U6m5008913 for ; Tue, 18 Feb 2020 04:34:25 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6e2f7nq3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Feb 2020 04:34:24 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Feb 2020 09:34:22 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Feb 2020 09:34:19 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01I9YIrt54394982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Feb 2020 09:34:19 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6BD211C04C; Tue, 18 Feb 2020 09:34:18 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8694C11C04A; Tue, 18 Feb 2020 09:34:18 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.0.197]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 18 Feb 2020 09:34:18 +0000 (GMT) Date: Tue, 18 Feb 2020 11:34:17 +0200 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] 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: 20021809-0028-0000-0000-000003DC0B7B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021809-0029-0000-0000-000024A113D9 Message-Id: <20200218093417.GB24430@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-18_02:2020-02-17,2020-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=1 clxscore=1015 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 adultscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002180077 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 17, 2020 at 09:41:40PM -0800, David Rientjes wrote: > The thp_fault_fallback stat in either /proc/vmstat is incremented if Nit: ^ "either" here looks wrong > 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 > --- > Documentation/admin-guide/mm/transhuge.rst | 5 +++++ > include/linux/vm_event_item.h | 1 + > mm/huge_memory.c | 2 ++ > mm/vmstat.c | 1 + > 4 files changed, 9 insertions(+) > > 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 through the ^ though > + 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/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.