Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2367387rdb; Tue, 10 Oct 2023 01:32:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmRPU9XigrMhpVC6J3TwMHWZ3ur23wOSsrs8m36DSr26WaFFKx0jy1oLKBe3TLFemjZCvT X-Received: by 2002:a05:6a00:8c7:b0:68b:e710:ee9c with SMTP id s7-20020a056a0008c700b0068be710ee9cmr20562693pfu.19.1696926766075; Tue, 10 Oct 2023 01:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696926766; cv=none; d=google.com; s=arc-20160816; b=zw62IKjAaFUIam//vS6W+PMbV9muSO1LhlX+5clqn43Qjj7fr4qN/7KnWrf3LwrsMU VVKeL1d6bb87TWiFc++sdfcFTgZ+sI9NyRapK5H4XWH5uXB75ac0G5r46QBXPWmGgFWL GWjj8JmsrQQd0MKd2fyKKDjarJqeo0yCQS7D8HD+r+kx3XNPMMCQeuI6R5KBfQsvFce7 TzCSOEkM5PQcDlmtS0mgU0o1WJjlqoFvcHu+H4aPHIEIbh+jK+oAnju5a47OLztJGWpB yE+csE1gR20cZpkd70pRdXAvxqKJ1X5QM7kruLuA48vpTWORlsPwbSqrxjhBoYKEn8SG QGeg== 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=l8wp8EZkNGWz+a7usr3RgY3QJlR87bE9BeQWjYhK4x4=; fh=WshF3VFuVECdjenMt2c/ihelCL0sRuHaGFWYsZpetzM=; b=wvjrZaFfquXgf0G4MkVYwd7+jaRxilT9EixywJRJDbngkKY43I0Dw2wzy7CSBlQNog vPfYmE7l5wa8bBoQ9cTSMFUT524OGCkfnOj+DLv+CIXYJ11qWskjy80rvP0jk72L5RyQ 8mI0O4J8VL+J0PiBbQ7hPItPggj0+BoSeXsArXctj7VXGsLsJHN5meC+ZW4WHXpY0Enk RmLaHydHGLUPI+3+y4C/ppA1WiMwdZ5GkyVNDN4C3cSwPMELv9cWj9IeWKcI0jqiQx7e 94h86LWr/P3zkiYfRkkgmpNdfxcIKdsZ6VIkf6JqUJuTs92T1+YcbTxZWSLNfOsNXtSk yiYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y7-20020a636407000000b005898e10f9c4si9487404pgb.203.2023.10.10.01.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:32:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5B66E812DBCB; Tue, 10 Oct 2023 01:32:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442876AbjJJIcl (ORCPT + 99 others); Tue, 10 Oct 2023 04:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442886AbjJJIck (ORCPT ); Tue, 10 Oct 2023 04:32:40 -0400 Received: from outbound-smtp36.blacknight.com (outbound-smtp36.blacknight.com [46.22.139.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DB79B4 for ; Tue, 10 Oct 2023 01:32:38 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp36.blacknight.com (Postfix) with ESMTPS id 3003A257E for ; Tue, 10 Oct 2023 09:32:37 +0100 (IST) Received: (qmail 8544 invoked from network); 10 Oct 2023 08:32:37 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.197.19]) by 81.17.254.9 with ESMTPA; 10 Oct 2023 08:32:36 -0000 From: Mel Gorman To: Peter Zijlstra Cc: Raghavendra K T , K Prateek Nayak , Bharata B Rao , Ingo Molnar , LKML , Linux-MM , Mel Gorman Subject: [PATCH 4/6] sched/numa: Move up the access pid reset logic Date: Tue, 10 Oct 2023 09:31:41 +0100 Message-Id: <20231010083143.19593-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231010083143.19593-1-mgorman@techsingularity.net> References: <20231010083143.19593-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:32:44 -0700 (PDT) From: Raghavendra K T 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 --- 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 0535c57f6a77..05e89a7950d0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3277,16 +3277,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 + @@ -3295,6 +3286,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); -- 2.35.3