Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2174949pxb; Fri, 8 Oct 2021 02:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB2WNaHd6u6pb9uPDO8tmLXtcgoObVIlIUliGEGDMa5z9G7+MeLRpJwdTaxGqs0iAYAP7r X-Received: by 2002:a17:90b:3852:: with SMTP id nl18mr10357757pjb.94.1633685160985; Fri, 08 Oct 2021 02:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685160; cv=none; d=google.com; s=arc-20160816; b=DZMYazYO60d/f0hB9QX1c/MR/1Y4xv18zuX1c4Z0U/fWVwZWQ/Isqwiv8Nfmjiw3vM OqxahJA6w1HyzcWl4QQeq7y04joTgANw/ztw2lonrys/0urChIsSVDHfYAtvduPsoXnD wyHwvL/zKrIELAzdSaNmXhowI8ZOv+bWA4TyO6q267SFAAjy0X1lVOh0jMS6yfFkKvex pcObd03oNtIVOYmWHMRytENsRsEzdNubZjsi/0tUxHTcoIrUKjSksiRSd0GUp5xxoo+L Bu4CPqFwM/uYjG3QJ81KBHJzaNGLKIQgARUYOxxxaCrsanUtilndh8fchHjvxF0e+1Kn eExA== 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 :mime-version:user-agent:date:message-id:cc:to:subject:from :dkim-signature; bh=BI1fdFpITncugnI8ZOhVcndov2suSbcgpwHQSA5zss0=; b=Id4+GEu4Y79AjzaVMV7Dlu4Mjg6xOUD7l7lMfL/c2hQAnEQI4hyZg/y9g6lx+Npc4h TAxsc7oEjCFLFnwOicXbjykTvzBMwKOy59kBYLNee95nWrzc8qCpipXacjjmNfp0xDbZ pKTPcGX3Bl7JvcO9T5DzdbtZOAHJsaz5j5Q2Qw4i2YDJeuAR9enn0nc4gOdZeyY3v95b KDQh2/1WAZUtCHzZ7lmIxTiOhhj6Mm8fdz6y/IcZb4WD6TobdI8T3fvURwd0w4KyQFq3 hdR0AFK4t2HrPR//mfoRWO7jqamEA8w6zBOjKBzLrLMhYJPjIkRAgDwwnqrkMyctAeKW oEZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iSABWY+W; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr16si5832508pjb.36.2021.10.08.02.25.47; Fri, 08 Oct 2021 02:26:00 -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; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iSABWY+W; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236335AbhJHJ0W (ORCPT + 99 others); Fri, 8 Oct 2021 05:26:22 -0400 Received: from relay.sw.ru ([185.231.240.75]:50470 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236195AbhJHJ0V (ORCPT ); Fri, 8 Oct 2021 05:26:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=BI1fdFpITncugnI8ZOhVcndov2suSbcgpwHQSA5zss0=; b=iSABWY+WWWhoqDCrxQC nB38taiVHhY686asLMwJQ4di0B+mUTrr288WyjGCl9ynJipevi7RY3SuBjRNjmNCLTlUj8mSE4ljD tQofyyvZhYa9lprVxChFOb4X+uFXhRoedlxKklPCAF/7NIpb/kdKl6V804E/sf2OLIncHyrVjYg=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mYm76-005QDp-IB; Fri, 08 Oct 2021 12:24:24 +0300 From: Vasily Averin Subject: [PATCH memcg] mm/page_alloc.c: avoid statistic update with 0 To: Michal Hocko Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org, Mel Gorman , Uladzislau Rezki , Vlastimil Babka Message-ID: Date: Fri, 8 Oct 2021 12:24:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 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 __alloc_pages_bulk can call __count_zid_vm_events and zone_statistics with nr_account = 0. Fixes: 3e23060b2d0b ("mm/page_alloc: batch the accounting updates in the bulk allocator") Signed-off-by: Vasily Averin --- mm/page_alloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 602819a232e5..e67113452ee8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5364,9 +5364,10 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, } local_unlock_irqrestore(&pagesets.lock, flags); - - __count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account); - zone_statistics(ac.preferred_zoneref->zone, zone, nr_account); + if (nr_account) { + __count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account); + zone_statistics(ac.preferred_zoneref->zone, zone, nr_account); + } if (objcg) memcg_bulk_post_charge_hook(objcg, nr_pre_charge - nr_account); -- 2.31.1