From mboxrd@z Thu Jan 1 00:00:00 1970 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 1F23DC433F5 for ; Tue, 12 Oct 2021 11:38:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A4C3A61074 for ; Tue, 12 Oct 2021 11:38:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A4C3A61074 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1C8526B006C; Tue, 12 Oct 2021 07:38:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 178DC6B0071; Tue, 12 Oct 2021 07:38:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06814900002; Tue, 12 Oct 2021 07:38:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id EAE586B006C for ; Tue, 12 Oct 2021 07:38:08 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9FDB9181D3030 for ; Tue, 12 Oct 2021 11:38:08 +0000 (UTC) X-FDA: 78687586656.39.87D780F Received: from outbound-smtp35.blacknight.com (outbound-smtp35.blacknight.com [46.22.139.218]) by imf19.hostedemail.com (Postfix) with ESMTP id D691CB0000AE for ; Tue, 12 Oct 2021 11:38:07 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp35.blacknight.com (Postfix) with ESMTPS id 2DAC81AB5 for ; Tue, 12 Oct 2021 12:38:06 +0100 (IST) Received: (qmail 17393 invoked from network); 12 Oct 2021 11:38:06 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 12 Oct 2021 11:38:05 -0000 Date: Tue, 12 Oct 2021 12:38:04 +0100 From: Mel Gorman To: Vasily Averin Cc: Vlastimil Babka , Michal Hocko , Johannes Weiner , Vladimir Davydov , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org, Uladzislau Rezki Subject: Re: [PATCH memcg] mm/page_alloc.c: avoid statistic update with 0 Message-ID: <20211012113804.GT3959@techsingularity.net> References: <29155011-f884-b0e5-218e-911039568acb@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D691CB0000AE X-Stat-Signature: g1hzjs1ytse1e7w8wstqwar9qmhi45h7 Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.218 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-HE-Tag: 1634038687-764885 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: On Tue, Oct 12, 2021 at 01:42:41PM +0300, Vasily Averin wrote: > On 08.10.2021 14:47, Vlastimil Babka wrote: > > On 10/8/21 11:24, Vasily Averin wrote: > >> __alloc_pages_bulk can call __count_zid_vm_events and zone_statistics > >> with nr_account = 0. > > > > But that's not a bug, right? Just an effective no-op that's not commonly > > happening, so is it worth the check? > > Why not? > > Yes, it's not a bug, it just makes the kernel a bit more efficient in a very unlikely case. At the cost of an additional branch in the likely case that may be mispredicted. > However, it looks strange and makes uninformed code reviewers like me worry about possible > problems inside the affected functions. No one else calls these functions from 0. > The accounting functions should still work with a 0 delta. -- Mel Gorman SUSE Labs