From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mel Gorman Subject: Re: [PATCH memcg] mm/page_alloc.c: avoid statistic update with 0 Date: Tue, 12 Oct 2021 12:38:04 +0100 Message-ID: <20211012113804.GT3959@techsingularity.net> References: <29155011-f884-b0e5-218e-911039568acb@suse.cz> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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