From patchwork Tue Oct 10 09:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 150624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp73457vqb; Tue, 10 Oct 2023 02:44:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnJEN5J3EVCfNH3MvKiCRlp/EqZOFf36E7a3U8IxaBPUexBjKBejY3mu9uGsbvVtkyNc4F X-Received: by 2002:a05:6a00:a92:b0:690:422f:4f17 with SMTP id b18-20020a056a000a9200b00690422f4f17mr18592816pfl.4.1696931071150; Tue, 10 Oct 2023 02:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696931071; cv=none; d=google.com; s=arc-20160816; b=jWGG8jNj6ypvS0UNjwM7nLjXVVqqrCchqVOvUHvmqNSYGRFejzIva7iAxKXGg9TR8R F0weDC5D9TJX6sWvZjyu9RJlKCbSmaHvPzQvDzspYsA13diZP4ONb48FaiktO6nbTRdH /B9u+/XEuaEZL9H5sHIHuQAc1gm6hyhhdm6gxKiVd+8V8wmcy88gp8vwnHGSr0CxdDjl 4d1NRm43q5nOCvm9JJRliZjmLr04THrXQcOJ4VJMG1ejFdd0ymS/uKn1SqkLIOyPiCU2 IVnq0E0R38Fj4X4Vjd38aIdL/qZqyxN2GKM0w9BYc1qEP7JPQDImDKUF/WGW5W/BBKWc m2Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=hyGfcz1FT6XDFHU1MwIubwjKxpqcfVPPlqtlsHiZTXQ=; fh=o1ePMzdH88uH7Weealx9Y2atC7sN2/G6Cp8iQg85ptI=; b=YbYXfO/tlAa/VuPL/UuRJU9OlWqsZbOuFdmcFPCTJsTXPgSOf4aPc4P6nTRKjzx0Oj 3Suzv25x0RWcxQizcDJ5C+x0/IPAyqOmK2+pfARVCT1IFyZ6DU+NAbvtzwyzfdzMrCZU VmGVOhUOSxGhzhMG1eQfSnHo5T19ExPs90yAb40Bz8aZv1mNjFZ4sXbRN82/+X/oUg2c P7iQ4FsNvJwsfqmlXnOWvo1u/S9i0VWUf/nEAsvj+whwQhf3H4eLu0YKBkJsqiWKxqZN +u2zXpjRUpLEWPQqLIUCtYfywjtE4s6+9Blj8IKkmfF5MNT4btsP+geZzHQ1Sh73e1FO qLlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TF78imSP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id be8-20020a056a001f0800b0068fccf2541asi9146350pfb.203.2023.10.10.02.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:44:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TF78imSP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F213980242BF; Tue, 10 Oct 2023 02:44:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjJJJoC (ORCPT + 20 others); Tue, 10 Oct 2023 05:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjJJJnw (ORCPT ); Tue, 10 Oct 2023 05:43:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C514B9F; Tue, 10 Oct 2023 02:43:49 -0700 (PDT) Date: Tue, 10 Oct 2023 09:43:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696931028; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyGfcz1FT6XDFHU1MwIubwjKxpqcfVPPlqtlsHiZTXQ=; b=TF78imSPGto4mYm4Ga9+Tjsk3udIDbja++oHLlM8MQueu1t0E2iaqAOgl62VBXFik2NENg S9w/gqHwoJc0CQnBfolETDQbD/soQBO20s0xmpZ9q9Mi8CBdzSq44Y2ErRY/8ZJK7eBgkq 2PbqNelN14G0mL8JPKw5qIPikdJbL/OTF4gkQNarnER7gmL52mMiSYzDth6UA5Yp9Lz3+/ MCr3U1CP9eaVdXWaLjZ8o+z1XryGgQBkvGoEgkbXHrZ4gkxW7EFxqeFrCTAd/pqHTa22wj PencerVBahIXYy/1FfF6MpQEnMySUd1hgOYz2eeBEG1+1zxkzR96CkqZhmYa4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696931028; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hyGfcz1FT6XDFHU1MwIubwjKxpqcfVPPlqtlsHiZTXQ=; b=8AvPuH7yEiBACGcpaRka20ra35j/6CrakMXcrQYq0YtLJQIXLEKHnZHvueo/9sa0fW73jQ ps5tdMtouZyWCrCA== From: "tip-bot2 for Raghavendra K T" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/numa: Move up the access pid reset logic Cc: Mel Gorman , Raghavendra K T , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231010083143.19593-5-mgorman@techsingularity.net> References: <20231010083143.19593-5-mgorman@techsingularity.net> MIME-Version: 1.0 Message-ID: <169693102782.3135.18020196809878344961.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 10 Oct 2023 02:44:24 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779356681952980106 X-GMAIL-MSGID: 1779361195138257466 The following commit has been merged into the sched/core branch of tip: Commit-ID: 2e2675db1906ac04809f5399bf1f5e30d56a6f3e Gitweb: https://git.kernel.org/tip/2e2675db1906ac04809f5399bf1f5e30d56a6f3e Author: Raghavendra K T AuthorDate: Tue, 10 Oct 2023 09:31:41 +01:00 Committer: Ingo Molnar CommitterDate: Tue, 10 Oct 2023 11:10:01 +02:00 sched/numa: Move up the access pid reset logic Recent NUMA hinting faulting activity is reset approximately every VMA_PID_RESET_PERIOD milliseconds. However, if the current task has not accessed a VMA then the reset check is missed and the reset is potentially deferred forever. Check if the PID activity information should be reset before checking if the current task recently trapped a NUMA hinting fault. [ mgorman@techsingularity.net: Rewrite changelog ] Suggested-by: Mel Gorman Signed-off-by: Raghavendra K T Signed-off-by: Mel Gorman Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20231010083143.19593-5-mgorman@techsingularity.net --- kernel/sched/fair.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 31cfdb0..ce36969 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3260,16 +3260,7 @@ static void task_numa_work(struct callback_head *work) continue; } - /* Do not scan the VMA if task has not accessed */ - if (!vma_is_accessed(vma)) { - trace_sched_skip_vma_numa(mm, vma, NUMAB_SKIP_PID_INACTIVE); - continue; - } - - /* - * RESET access PIDs regularly for old VMAs. Resetting after checking - * vma for recent access to avoid clearing PID info before access.. - */ + /* RESET access PIDs regularly for old VMAs. */ if (mm->numa_scan_seq && time_after(jiffies, vma->numab_state->pids_active_reset)) { vma->numab_state->pids_active_reset = vma->numab_state->pids_active_reset + @@ -3278,6 +3269,12 @@ static void task_numa_work(struct callback_head *work) vma->numab_state->pids_active[1] = 0; } + /* Do not scan the VMA if task has not accessed */ + if (!vma_is_accessed(vma)) { + trace_sched_skip_vma_numa(mm, vma, NUMAB_SKIP_PID_INACTIVE); + continue; + } + do { start = max(start, vma->vm_start); end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE);