Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp251939imw; Fri, 15 Jul 2022 02:26:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sVTengwveQqN1npnNixmo0o5yRM8n8NHIL/Qj5rOk7WJDN4Nk6WMo/BCtqqMfoxabi8qR5 X-Received: by 2002:a17:907:7292:b0:726:95e4:5a21 with SMTP id dt18-20020a170907729200b0072695e45a21mr12661529ejc.266.1657877174014; Fri, 15 Jul 2022 02:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657877174; cv=none; d=google.com; s=arc-20160816; b=Ryuq/CitWQteuUFcHAuaP7QqCDLIw8rwoOG7buRmk9UGVv9NE8DSBwuq6UndL2Az5X P+jxpMesFFPsIRMs3eMMAZP1Ckk+LvdsJrtm2O+t2bVOqldhZAfV3gJlG6gZKPys4Za6 uDHua82tQT+SeCHG2V5vrlV+Jmnag8VxSWZ3oHVDAF/T2LTtCVLmG3/OwXQLAveSrgBr u59p7UiXfSasL/qsmPpLkUlV+KuYEtpnIoYCTD1O5lLwgDNVwl1XNAkLrCjjdgzQ5KMB L/njZ4vjgpRz/NCzJDCc1C7BjFq6rQH1GacV9DqLUJ3zoWot6balPYiyJu7H3ErMGYJF O4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:dkim-signature; bh=TD4qyCc2/sj7H2ZxOu63AnfBrd6X3bmHJua9yUIs4LE=; b=s+L1o2Xc8OPTy3QSy/Raa3V6l+iaHJHrEw2JW2FQaeTrijyTl+0eFUq1n9YhR1OZfD 3jTwZpWMHMEbV7WDqQ5uCBEXaf4sLAOGMAGGa87fFE2YMwWysemlegfo8mRrymjn9wGb PfkB+RAfXo9EoJOGrt+bIby9NOy+qFqUO1ZG8Nut7Jqkqq+zco6mC1GIJ/nYyUCrnwlv ZpPQ610Zqig5CJ/Y64nMWaLhlrhEJG7fLk4S5nIY1ioOsTJQR0jLq8Jtudj/NIDKzLPd Is0YX4z9XNXCWxk6lmgfQoB5hUW7sb44nlglQjeRq4mpGvDJ1XmkiqeAEfFocKIRlfmq 8fPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=IOdQtUmz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a1709067fc600b0072b3ccd50dasi4208634ejs.905.2022.07.15.02.25.49; Fri, 15 Jul 2022 02:26:14 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=IOdQtUmz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbiGOJXO (ORCPT + 99 others); Fri, 15 Jul 2022 05:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiGOJXM (ORCPT ); Fri, 15 Jul 2022 05:23:12 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB8F606BB for ; Fri, 15 Jul 2022 02:23:10 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id ay25so2473321wmb.1 for ; Fri, 15 Jul 2022 02:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=TD4qyCc2/sj7H2ZxOu63AnfBrd6X3bmHJua9yUIs4LE=; b=IOdQtUmzYtMIGdBcmR6YH4RTXqeuv1jnKhGuBLoH3LaqCbrVfundg54tIGrIMTYixv 1IQHYKENaJTmi1M8SD3lZsTpuBJRl6oC5YIl4biet5e4pc3S+NyTa6jNnTcgkNInC0Ni EWXLHr6QYRmB6NRO8DOyI538nAi5/98etXrXVN55tYd+PqeBKco5DqXRlnMNfQGeEk/Y clYXCnfIufKZZf0JmdhIDgwkcVwwrIM2b/iPYrtkG0b3AnfO1dbZam0mVh4FAq/qvglY MbSefbBwrU4chpClZqTrDMwRJUmaIdVlhqbU97C0OylOTT659Vi0kHLPkEoghvPkWiFm XIeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=TD4qyCc2/sj7H2ZxOu63AnfBrd6X3bmHJua9yUIs4LE=; b=caQ3QklD8+gawT9iCD2ILytVfD/r1+blj89yCgARdt+RjlZ8kioPKzIdD6yaOpbFzv rVu+MNvcxOWIKExjKrMViA+CxA1tLchBY95HkKQLNSDTmGqNlaZoB+7mUti/5l/3gvYW mBxkTWiW0omMBK2d+zjWbEziApC1msxQ39tgTAzoxgREE5QOQkjS/AwzdW90p1t8K0Pf KrG0k8o+yhxJkzTsARERExpFZCUESpSNqG+Zz2CGNqwIlD8TFwyDOwnPrD+hv6A63U48 Q7NViedgJ0V+cJ3+xogT+u8XkdYwLWiS+znoKWzHYPfAxIVEoLA5B9KyPCbq7iGUNQdg Ru+g== X-Gm-Message-State: AJIora8kyY2HvpdzzxGChPvIAqozscV2W8TyFrGiv+6SXZ6fgXN1aMPB Sqd99ozHmXOFFmZZ4e4BbwjZdpcAGnOPmA== X-Received: by 2002:a05:600c:3510:b0:3a0:f957:116e with SMTP id h16-20020a05600c351000b003a0f957116emr13028177wmq.179.1657876989101; Fri, 15 Jul 2022 02:23:09 -0700 (PDT) Received: from localhost ([109.180.234.208]) by smtp.gmail.com with ESMTPSA id n66-20020a1ca445000000b003a02de5de80sm8181569wme.4.2022.07.15.02.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 02:23:08 -0700 (PDT) From: Punit Agrawal To: William Lam Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: compaction: include compound page count for scanning in pageblock isolation In-Reply-To: <20220711202806.22296-1-william.lam@bytedance.com> (William Lam's message of "Mon, 11 Jul 2022 21:28:06 +0100") References: <20220711202806.22296-1-william.lam@bytedance.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Date: Fri, 15 Jul 2022 10:23:07 +0100 Message-ID: <874jzin30k.fsf@stealth> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi William, William Lam writes: > The number of scanned pages can be lower than the number of isolated > pages when isolating mirgratable or free pageblock. The metric is being > reported in trace event and also used in vmstat. > > This behaviour is confusing since currently the count for isolated pages > takes account of compound page but not for the case of scanned pages. > And given that the number of isolated pages(nr_taken) reported in > mm_compaction_isolate_template trace event is on a single-page basis, > the ambiguity when reporting the number of scanned pages can be removed > by also including compound page count. A minor suggestion - It maybe useful to include an example trace output to highlight the issue. > > Signed-off-by: William Lam > --- > mm/compaction.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 1f89b969c12b..1b51cf2d32b6 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -616,6 +616,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > break; > set_page_private(page, order); > > + nr_scanned += isolated - 1; > total_isolated += isolated; > cc->nr_freepages += isolated; > list_add_tail(&page->lru, freelist); > @@ -1101,6 +1102,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > isolate_success_no_list: > cc->nr_migratepages += compound_nr(page); > nr_isolated += compound_nr(page); > + nr_scanned += compound_nr(page) - 1; > > /* > * Avoid isolating too much unless this block is being > @@ -1504,6 +1506,7 @@ fast_isolate_freepages(struct compact_control *cc) > if (__isolate_free_page(page, order)) { > set_page_private(page, order); > nr_isolated = 1 << order; > + nr_scanned += nr_isolated - 1; > cc->nr_freepages += nr_isolated; > list_add_tail(&page->lru, &cc->freepages); > count_compact_events(COMPACTISOLATED, nr_isolated); Regardless of the comment above - Reviewed-by: Punit Agrawal