From patchwork Thu May 25 12:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 99009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp346945vqr; Thu, 25 May 2023 06:00:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aYpmE3f3PTTj6m3GOxWZYReHXnmuQmvHm1OlF5XcqQQ5lPo4GU9LNrbGMHB+B2LlVlKzS X-Received: by 2002:a17:90a:a88b:b0:252:aa5e:e54f with SMTP id h11-20020a17090aa88b00b00252aa5ee54fmr1748288pjq.13.1685019622689; Thu, 25 May 2023 06:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685019622; cv=none; d=google.com; s=arc-20160816; b=fuGQ5qsFvt8uEqNWoFi9tQxBfELVf4xHxjmaI4MqpDZuTX2v4Ui7lgW7pP0QPjz+Us YqnV1GGHYuRm4Pu1lIHZBKUXNt000Ir5jMkYnzG05x2hkFECwr3yu3lKHJgyRp2DWxg8 a3aBFdb/0rWNCVuMfdrjDHZjp1aGDaat9cC1DtR0NfNHZCaKUpW4TdVIHWo//D4OPEVf GubKnBl0C5Ybf0XJKvlxCJCf/sdM2KliwEP6JRiHGFEgvk26rEY4i9WcNBWE3qpJ/Ddz 3qh6oZvkHzl80/bKYgwRodHen/6gsVaDgo9SSOA3tkVxMY/xqJqfXRAaz4USQkyMc3zw ilLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SdT5R3m9rZCokN9uO6H95AhoqA+livNaJXRoPZKNaD8=; b=jKzkv0kiLlZorqgF8lFSPO+Jv+V6c70t7OATbur3coEYKT3C24DSUxD7tJ6OWVIabd okq/lES9lwU0oRi3vhfY4Nf6x8xXJtcif/ywpMmzyQ4sm2PpsD51xE3riGvSo0Mixpji oTcT16u3ofrWQFxK1VRXnSrLSox9G3J+7axEehm0RzCmfKj8T5X+F2+oEjXO1mXlp22o 4pP6tTvQ++kcYlfp9tBLGWgPpsJ8vjNsOPUwyiC2yu6wuIqxM0zd924PyQKn4WMhTlmV QzTYE59Jr8pYn/hq69DjSSUrCQcE47Y6k5GNur8rstcBUDTBzlevE15TRRpNfl5ywmq3 Vhcw== 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fh5-20020a17090b034500b0024e3c22a7dbsi2427665pjb.113.2023.05.25.06.00.08; Thu, 25 May 2023 06:00:22 -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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241078AbjEYMya (ORCPT + 99 others); Thu, 25 May 2023 08:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231895AbjEYMyV (ORCPT ); Thu, 25 May 2023 08:54:21 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C5D187 for ; Thu, 25 May 2023 05:54:20 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R781e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSMoYJ_1685019255; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSMoYJ_1685019255) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:16 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] mm: compaction: add trace event for fast freepages isolation Date: Thu, 25 May 2023 20:54:00 +0800 Message-Id: <78d2932d0160d122c15372aceb3f2c45460a17fc.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766871135748557893?= X-GMAIL-MSGID: =?utf-8?q?1766871135748557893?= The fast_isolate_freepages() can also isolate freepages, but we can not know the fast isolation efficiency to understand the fast isolation pressure. So add a trace event to show some numbers to help to understand the efficiency for fast freepages isolation. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- include/trace/events/compaction.h | 11 +++++++++++ mm/compaction.c | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index 3313eb83c117..2b2a975efd20 100644 --- a/include/trace/events/compaction.h +++ b/include/trace/events/compaction.h @@ -64,6 +64,17 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) ); +DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_fast_isolate_freepages, + + TP_PROTO( + unsigned long start_pfn, + unsigned long end_pfn, + unsigned long nr_scanned, + unsigned long nr_taken), + + TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) +); + #ifdef CONFIG_COMPACTION TRACE_EVENT(mm_compaction_migratepages, diff --git a/mm/compaction.c b/mm/compaction.c index 65d8d9223acc..eccec84dae82 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1438,7 +1438,7 @@ static int next_search_order(struct compact_control *cc, int order) static void fast_isolate_freepages(struct compact_control *cc) { unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1); - unsigned int nr_scanned = 0; + unsigned int nr_scanned = 0, total_isolated = 0; unsigned long low_pfn, min_pfn, highest = 0; unsigned long nr_isolated = 0; unsigned long distance; @@ -1537,6 +1537,7 @@ static void fast_isolate_freepages(struct compact_control *cc) set_page_private(page, order); nr_isolated = 1 << order; nr_scanned += nr_isolated - 1; + total_isolated += nr_isolated; cc->nr_freepages += nr_isolated; list_add_tail(&page->lru, &cc->freepages); count_compact_events(COMPACTISOLATED, nr_isolated); @@ -1557,6 +1558,9 @@ static void fast_isolate_freepages(struct compact_control *cc) limit = max(1U, limit >> 1); } + trace_mm_compaction_fast_isolate_freepages(min_pfn, cc->free_pfn, + nr_scanned, total_isolated); + if (!page) { cc->fast_search_fail++; if (scan_start) {