Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2339048pxb; Tue, 12 Oct 2021 04:40:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy293EUG5JNvR2fa/Z/09QlKnUoawrTQqEJ32UMzTtcl6tWfSrxEtLSuXe+yFQUj3ioUgky X-Received: by 2002:a50:9347:: with SMTP id n7mr48570713eda.249.1634038834198; Tue, 12 Oct 2021 04:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634038834; cv=none; d=google.com; s=arc-20160816; b=PGyH6gy6kBCU50Y9XF0/34FkOKII+rXLHlAK0bSB/2BR4FjaihxoYi0splTPst18vX nAaebk9THahXFBqs8tqQy5+04YRnvAIcLeUOVvQ3Kii2hlnKhFucQ2XhHZyKZg5pa3Zh c6aLYV+i+8Q2Jd6NjIP1reG5r9v2lQm7wWrl15tKSS4L60CNapP/kqsEohqCeomMSTBN pDwroNlew/7n/WpNH64jj/r9xecRdEv7jPY+1BYUYVu8OwHSayxbaa9XkmLH1X8//1yb yg9N6vRHE3wOBzwV1ptrCCQtqFNS+n4VZ5+/aYgrFIFXzYkgHJkXdfMenlUgSkUmjz8X ugrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tk2t1Zn/4MWprinH9wor/oSHBXrzbSIuklBycdtl28Y=; b=pWZGJnyqsX8+smCvIO6KQk1IXVyYHMh2IrJVkmaNokiMUXAgZW/ZR95ORFuA1rAIj6 aYwgBOIw5bUf4c7a2tjovstRc+BA74pBO0srq/SjMZxj+Nz5amLYJ2OpLJzSyj+lsiRY 8RcKBsjU1H2hZjB67ZRSDN9UmMSwTAefAjMcqqwpXT3OpuCpwNpKxBdyBdy3Bj4hdSh+ SlJ2OU6P8n4eJM/q6C+3ZSnkjLcnKZiNi2nXiM5Ubv4GhbNazvXQwCAy7OSG8dtIn4gK n1p9zfMqfVZaYGvTQuvjuoq00hpGynxHfHK2apuC/5OmBdin+jhsg7i+UbX6DoIwZ3pP 9VDA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h18si14853596eja.209.2021.10.12.04.40.09; Tue, 12 Oct 2021 04:40:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236177AbhJLLkK (ORCPT + 99 others); Tue, 12 Oct 2021 07:40:10 -0400 Received: from outbound-smtp53.blacknight.com ([46.22.136.237]:34479 "EHLO outbound-smtp53.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236289AbhJLLkJ (ORCPT ); Tue, 12 Oct 2021 07:40:09 -0400 Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp53.blacknight.com (Postfix) with ESMTPS id 3314AFAB37 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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