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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B5FECAAA1 for ; Mon, 24 Oct 2022 16:56:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF7F2940008; Mon, 24 Oct 2022 12:56:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA776940007; Mon, 24 Oct 2022 12:56:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6EF0940008; Mon, 24 Oct 2022 12:56:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 96E5E940007 for ; Mon, 24 Oct 2022 12:56:27 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 41731C0CD6 for ; Mon, 24 Oct 2022 16:56:27 +0000 (UTC) X-FDA: 80056446414.03.6CE07CA Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf22.hostedemail.com (Postfix) with ESMTP id D410FC0005 for ; Mon, 24 Oct 2022 16:56:26 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id e129so9142731pgc.9 for ; Mon, 24 Oct 2022 09:56:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kIGjbP9zJPjIy2yzyFXS3DkAMVogbE+K2En/NCnUYeM=; b=SHJJlZDJmoYhxyn0ITwq11rrRSH6pCc8BEpfWvCPHeEBbUSEYbNtGWKBnJm8cGdWRc +McRfSLNO9IX/GwirB0GxiJLL3TT3shloUkX7SZ/Sq+Xb0Y6KjB5XCCR8VWcX5MZCYo3 b3SlroB7mpsjab6tNFiWZGE/+vOu16UtDHfBDVOs1fI5nxUifb4FwccDjDFnBmM1w01x OphMXCpMEpYiZEOea5UyosyBsvl9A6dIZxYs+MCICnCRPGlLIO/1y6IPP8w2LRIyLw6a Xog9GoI5JiwP3rGKeCgYS6zaYttiZ9pFLtrlkvzdBYTcujBQ1jzWUA8d+mNnYQrkFyLT HIBQ== X-Gm-Message-State: ACrzQf3wz6LlH9yRHHpywo4p7IBrYRgVcpooEoL1P4+LYoi8vS7vVQTz kKVAUfedy9Lrj3QPtH+SZm8= X-Google-Smtp-Source: AMsMyM4Hw4wD2EqxdPbc4wSaZOdf1mbANxGChCppXIyzUqWiOx01KHylU/hxqjpp9VnEv++7TQgJPA== X-Received: by 2002:a63:824a:0:b0:46b:272f:d75f with SMTP id w71-20020a63824a000000b0046b272fd75fmr28564028pgd.268.1666630585932; Mon, 24 Oct 2022 09:56:25 -0700 (PDT) Received: from fedora (136-24-99-118.cab.webpass.net. [136.24.99.118]) by smtp.gmail.com with ESMTPSA id k3-20020aa79983000000b0056bfa2cf517sm62732pfh.3.2022.10.24.09.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 09:56:25 -0700 (PDT) Date: Mon, 24 Oct 2022 09:56:22 -0700 From: Dennis Zhou To: Baoquan He Cc: linux-kernel@vger.kernel.org, Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Message-ID: References: <20221024081435.204970-1-bhe@redhat.com> <20221024081435.204970-5-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221024081435.204970-5-bhe@redhat.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666630586; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kIGjbP9zJPjIy2yzyFXS3DkAMVogbE+K2En/NCnUYeM=; b=j2oESbYNG4w1KZtNbg6Eb+dN413aEDnwJrCFtfM5M/QiphSIywm+EDnB+T0//v1V0rrGID eFih08jcjBVSJm73ED+mtgBrXl1rHEO3Z1ux9kJ28vMGqxU3G86tI2w2/TOyH4RZYpHuSn rwU+6k8kWeN5j+3dP8hE56ABcA/8r7A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of dennisszhou@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=dennisszhou@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666630586; a=rsa-sha256; cv=none; b=E/Z5uGMrowtd67IQOiQnekUL4D9/nZLE7qd5FZy6PMPYFb+yBqOf4jfK2c7s6x4MkNNbWq 6KPGu0rbGxIlbUDrDyW9uTopR0njBJjLGk1IGODpA5P+SzkuClqVrMidPX6fdDStwl4A+S n3svRF2FXOjagTf6hQdMdPgjmY7cEFM= Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of dennisszhou@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=dennisszhou@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-Stat-Signature: a9mwzfek39etjs6fondxn1kcnjacggap X-Rspamd-Queue-Id: D410FC0005 X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1666630586-160651 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 Mon, Oct 24, 2022 at 04:14:31PM +0800, Baoquan He wrote: > When allocating an area from a chunk, pcpu_block_update_hint_alloc() > is called to update chunk metadata, including chunk's and global > nr_empty_pop_pages. However, if the allocation is not atomic, some > blocks may not be populated with pages yet, while we still account it > here. The number of pages will be subtracted with pcpu_chunk_populated() > when populating pages. > > Adding code comment to make that more understandable. > > Signed-off-by: Baoquan He > --- > mm/percpu.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/mm/percpu.c b/mm/percpu.c > index a8121302a79c..09e407338573 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off, > > /* > * Update s_block. > - * block->first_free must be updated if the allocation takes its place. > - * If the allocation breaks the contig_hint, a scan is required to > - * restore this hint. > */ > if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS) > nr_empty_pages++; > > + /* > + * block->first_free must be updated if the allocation takes its place. > + * If the allocation breaks the contig_hint, a scan is required to > + * restore this hint. > + */ > if (s_off == s_block->first_free) > s_block->first_free = find_next_zero_bit( > pcpu_index_alloc_map(chunk, s_index), > @@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off, > } > } > > + /* > + * If the allocation is not atomic, some blocks may not > + * be populated with pages, while we account it here. > + * The number of pages will be subtracted with > + * pcpu_chunk_populated() when populating pages. > + */ > if (nr_empty_pages) > pcpu_update_empty_pages(chunk, -nr_empty_pages); > > -- > 2.34.1 > Heh, that's a little more subtle than I remember it being. Acked-by: Dennis Zhou Thanks, Dennis