From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CF2437F73C for ; Thu, 26 Mar 2026 02:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774492118; cv=none; b=AUJ7+V7BcXQOyCuEsi3ThmWWqtKUr2+3W2qLYuzp+8IKfr3JgfywpQMVLLV31Stne2z1HCp543y3Na1QQenxwGuPSdUl2tcpZw6ggLGUPMeyRFJHO+7ZkjKGXe8iNGd1nU3+Xd5xTDREOsGW8p6UvubS9GMyelPoPcORywXCMqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774492118; c=relaxed/simple; bh=XYsQVi8LZ7up/Vsh/sEein5NaUwK8JywpM4rSfY2bDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eXvVUlIl1MzBcUXr89ozk/rMfFAEGSDsqiBK611LhEWYoNJEPtU4/OqKycXOH3oEwpQRplJFazvioXvMiU30ipE1xMSpsj9hhg+QAuBN+2226uIf8wvXzrpI5tzgAinQeybgPqYxvWw/Fy+3mvHmmUkoEVlrpDcEaCeeBU8cmio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JMUY7mju; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JMUY7mju" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2b0603ee486so2928195ad.0 for ; Wed, 25 Mar 2026 19:28:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774492117; x=1775096917; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nLWvjE/N6MuE6bPF9mB0bB6TwGLKGdda0eAW278f7KU=; b=JMUY7mjuq22VX950LVdO+Xwqakgxgnh6Wtk3fQ5/9GcC88QxMY2WKSLrihClMxbHJh wuxqdW/PcyxujBpCH/Kc/evKVwsK0y9Bp3XWPwTJJbrGJ27JyZPHVQfbTNze3AL+PNJ6 VtX4Yg6QqK/gxqxFcekqUq/L8ZN+IZJxIDKSIefMAvk+30y94WVs6T4NGSbcHoQbxKTL T552OCtlAFSKoWRH+tO5NHDboH0oBioLXO1n1rz7bWNlGKUZP0pPM1RBKujHrzk8NRxm SNkBx66N+w3R9BVKeL3572+oLbW7z4O0vfGXdlahHdEPL5EfaYuZhp3jQ2B354iKDG1m 5+TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774492117; x=1775096917; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nLWvjE/N6MuE6bPF9mB0bB6TwGLKGdda0eAW278f7KU=; b=YoQPveNG5hRRTMIUUSp1uDT/9b3e0tgtSBVz/OKt1qJBzcEgtzt4y1gFT37gHjIoWm 0ZrD/No8fyMhuNeV01y2WtNVF7xpW9+Zd/GeZOR5lI8J+WiTPkEMepWJGOcSbEtDI8zw VnFwfpXcN60ucTRnce7Q5mappipZVuTtHKm3hvQWCdH9HnTS2GIbw7FfsgtWyEwr9KtM I/r10DqdwXDUeZk5g/lqNoRC7iHlFxLvEy+MU3WGPWXq9CUFyRLFR8tSQ4LawBlm/3vY ICt6wdtyt3aJAf/tSOsGjAzJ055qbHXQtbqew/27HnVqf23zfctlLVFJubHz9aC/NQOF +3Nw== X-Gm-Message-State: AOJu0Yx2u/Eu/He3YSbnHilqtAvVxjbJeaQA1nY4gvQBNrjIuGHqlZXI jxVDS4JrzkusPo/qdmQBJxehjj+FCSOMdeVFRNcA+PZNE2W6NMHwqfAMYTbXCA== X-Gm-Gg: ATEYQzxo6U6MGlWBFUoXgQyUqerVRNbWb/uXxIt4xsAjTQY/jnfnydFoIRZ/4Hjuj8W UeMzx5ng5wQ2pzvKySk2AFMUtgl2CmsdC6KnGHRHSfEUR3MoDtOmxrM0UK11rY/pJBW/RTEST2O iw1kkfuuyVMeAA0Hl1vsFVKN8Ao3rC8rCUANRsJPWPhbxiE3pnipuxH+yGKDBrKRhwjLy/1irNu 6Al6X4lhW7TVgAsanqgSqWs6bG4UW/zhRBNTVZCoLAOwO7NAWWSVLMyTbujuyTw2mCHjEeToOrj dEfZj1g9nso2GraFhooPwc5DFGrZNlffPJ5e5HwLQKl06Uyq3MQIP3NciYY8hPYUDDKScfKf5bG BVe2dVPWT+MXeWJtc2BrDRJ/xYuF/HoIaDmdGpRV6PeBGQHiIT3691jxiApd/8L4ETipByrhfoA +QXNKfQ+3G6gvFEjLC/BzVCCcfk2ljSKThpYl7wS4heI66LBYRcW3nIlBru1fZ97n1Vk0wWZ71S V0hugSbEWMUaQ== X-Received: by 2002:a17:902:ebc2:b0:2aa:d5e5:b136 with SMTP id d9443c01a7336-2b0b0af3befmr70874635ad.38.1774492116948; Wed, 25 Mar 2026 19:28:36 -0700 (PDT) Received: from mi-HP-ProDesk-680-G6-PCI-Microtower-PC.mioffice.cn ([43.224.245.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc76f184sm12969355ad.9.2026.03.25.19.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 19:28:36 -0700 (PDT) From: zhidao su X-Google-Original-From: zhidao su To: sched-ext@lists.linux.dev Cc: linux-kernel@vger.kernel.org, tj@kernel.org, void@manifault.com, arighi@nvidia.com, changwoo@igalia.com, peterz@infradead.org, mingo@redhat.com, zhidao su Subject: [PATCH 2/3] selftests/sched_ext: Fix dsq_reenq test reliability Date: Thu, 26 Mar 2026 10:28:26 +0800 Message-ID: <20260326022827.3826287-2-suzhidao@xiaomi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260326022827.3826287-1-suzhidao@xiaomi.com> References: <20260326022827.3826287-1-suzhidao@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The dsq_reenq test was using NUM_WORKERS=4 on a 4-CPU system, so each worker ran on its own CPU. Workers sleep 500us and yield, getting dispatched from USER_DSQ almost immediately. By the time the BPF timer's deferred scx_bpf_dsq_reenq() fires, USER_DSQ is empty and no reenqueue event is observed (nr_reenq_kfunc stays 0). Fix by increasing NUM_WORKERS to 16 (>4 CPUs). With more runnable tasks than CPUs, USER_DSQ always has a backlog when the timer fires, so scx_bpf_dsq_reenq() reliably finds tasks to reenqueue. Signed-off-by: zhidao su --- tools/testing/selftests/sched_ext/dsq_reenq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/sched_ext/dsq_reenq.c b/tools/testing/selftests/sched_ext/dsq_reenq.c index b0d99f9c9a9a..fe18c6af3877 100644 --- a/tools/testing/selftests/sched_ext/dsq_reenq.c +++ b/tools/testing/selftests/sched_ext/dsq_reenq.c @@ -15,7 +15,12 @@ #include "dsq_reenq.bpf.skel.h" #include "scx_test.h" -#define NUM_WORKERS 4 +/* + * Use more workers than CPUs so USER_DSQ is always backlogged. + * With tasks queued faster than dispatch can consume them, the + * periodic timer will always find tasks to reenqueue. + */ +#define NUM_WORKERS 16 #define TEST_DURATION_SEC 3 static volatile bool stop_workers; -- 2.43.0