From patchwork Fri Oct 8 09:24:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12544719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72453C433F5 for ; Fri, 8 Oct 2021 09:24:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 111AC60F70 for ; Fri, 8 Oct 2021 09:24:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 111AC60F70 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A94F9940008; Fri, 8 Oct 2021 05:24:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A45736B0072; Fri, 8 Oct 2021 05:24:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9348C940008; Fri, 8 Oct 2021 05:24:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 8677D6B0071 for ; Fri, 8 Oct 2021 05:24:28 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 470DB2D011 for ; Fri, 8 Oct 2021 09:24:28 +0000 (UTC) X-FDA: 78672734616.01.0475414 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf09.hostedemail.com (Postfix) with ESMTP id F2E1230008D0 for ; Fri, 8 Oct 2021 09:24:27 +0000 (UTC) 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-Language: en-US Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=relay header.b=iSABWY+W; spf=pass (imf09.hostedemail.com: domain of vvs@virtuozzo.com designates 185.231.240.75 as permitted sender) smtp.mailfrom=vvs@virtuozzo.com; dmarc=pass (policy=quarantine) header.from=virtuozzo.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F2E1230008D0 X-Stat-Signature: 657c5j7bcs8i7s8ugi636ks1egaw7tiz X-HE-Tag: 1633685067-403846 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: __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);