Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7259291rwi; Mon, 24 Oct 2022 12:01:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7btUfgo4OvP2EXa0SM4xEznpHE9xmz37MgGLvaC9pB5n/1Hy2EHolhdomyvnGXN5WSAWLB X-Received: by 2002:a63:5547:0:b0:456:c63b:7139 with SMTP id f7-20020a635547000000b00456c63b7139mr29848139pgm.179.1666638064580; Mon, 24 Oct 2022 12:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666638064; cv=none; d=google.com; s=arc-20160816; b=dlFwa7bpvFXTuNn+VbvFTRRlwnoGeXdRMkMYYjQsG8sWXpW9FIPqbvHddj6v9McaBl 4BWW8OJuF/oWqOAcsdOy3wE1CVyVr/ySVXpD2u6aJcR5b5Wm5dvG4FK9SxyB6w1eeiz4 BZ9/SdB2CXggEaFBRf0JR6UcxAVegRoTMdSUN7zu8obpddpWqZcebMJe1amvovL/a1SZ 6vRrll8w6OQbIlUYx35qx4MbNBwwtBa8XMS012GqIfyhGeXpChLktlItOfsn91U2ReBQ d6Jze7Wl2jAiZi9jVmuTjhMrQ9ZVWMtS9iaZYx3xG3VpLl8PH7zbIN7w2YyxozWKplER s5iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=kIGjbP9zJPjIy2yzyFXS3DkAMVogbE+K2En/NCnUYeM=; b=Z4anVJilET8Dphl9LGGFyyyr0z49y9sPuzxusHbgFVkraDrqUl8ucD2sDogBgnr/mq +CxH20/4db5aKDOGgCm1s0y9UHqSvjWLephmlRN0FAodoSk5fBjL/jMsezFLotT5SIkB qB1twcHxx7GHf5fDvhK6oPms4Dy60Nz0k6PW1RSnus5ZcXLKfFBobwSb7nlQWdumibgm PZ6uOECSG7j+rkWOPGv+QCGhDDqS98gJKKBF3N63AM3arVqjITpbkpJb242aidppvhk0 grEUJVSVj2ORZUwp7q/wmISAgjgRtI11JqX9GCWmhPv3LDiHyYqc/I3HFqHMoSftrgC6 fPtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l191-20020a6391c8000000b004541962a9basi219560pge.701.2022.10.24.12.00.51; Mon, 24 Oct 2022 12:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231464AbiJXSRu (ORCPT + 99 others); Mon, 24 Oct 2022 14:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbiJXSR3 (ORCPT ); Mon, 24 Oct 2022 14:17:29 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 353FD27B54D for ; Mon, 24 Oct 2022 09:58:50 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id g62so5447995pfb.10 for ; Mon, 24 Oct 2022 09:58:49 -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=NDGGOS8dG8JemCl0zfwXa40XSrZ860udAOe6g0OM0u+V2qtEQBj2EbSuwhKOj4RKxf 33l1qJ5HWGbm+ram/fUdt/Z0XIQGtRwvtERgV5kNHX/xdDDHyvQhLti6PUeJg0pQXtB6 6VL9rD7/M4RzztXGPS3FYlKmMWH4vDzE3bKTQIKh4YEGfwY1Yl0ILooQoB1+z4f0e3s9 jEs5Nzr5voQ+G4Da/WCOMQLqYMjr7DYLXQrGjZCUmDHGDdG6OwV2XfoZZHk0/lIu3irl nwNCDjPqoI5su2h8z94uVrbXTE3WJWUqedZEfx2N2pPhy8Ch9bNDdRrflMr2+gPmXMly HAIw== X-Gm-Message-State: ACrzQf0vzuKubpcbw3l/zS571Tchyo2Ljs+Sr+wCvQ494q/ufsA5uT89 KpX9FVE4mw5wkke9sjGOHBo= 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> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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