From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 11EA23D9DBE for ; Wed, 24 Jun 2026 15:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782313963; cv=none; b=kJRWxk5ROFmNagdEt3mbtKfyHHhJ92VUY4XswPml2ag/981S9QqYAh3KcL1FNc3CDRspvSIL/1B5uKuR7SquuyjQ0lDEudtBL3mu4BF9Oxo1rVfrV+qqWnVL+WxuJHIxG4W1x+O6uM02bcplL119bQgdYjxgz0M+N9qMM9sGv+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782313963; c=relaxed/simple; bh=ceg7BXxIGo4oNTnZuDiyD8grXjrbNsiBxJmtUutSN9E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qNLMiMacJNyfUj6/sOl6KZNiIYn2fS+veuhGI+HMbagvu9eKy0GNyZ4Z89uUf1L30x5P8pOnvVwEjsEsR7u7QptzwKRQx9MjeXasfEmcrAhoMBRCCJjZY1W2fD+WwDPeKg3JrH5ihDh6oWitOQVz8CDZZ2837kNguTe90YWx0VU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pwzTvylq; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pwzTvylq" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-490ace40f4bso11820075e9.3 for ; Wed, 24 Jun 2026 08:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782313960; x=1782918760; 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=5O1SbVtatMzIgtgHChbbaSaj+UiSxNdbbreZyfkCgrE=; b=pwzTvylqYVoWf+FuRUfjY+DJRbFjlVFx0+4fuhHPBs1Kf7x1BdU/lAPGF0hBKuo+xG rTntCRPIteb9qNJwbFkiXkn2qFwbsgJjgFcdVu4EgDMU06l23XHCTishRMX9zdenuQEC DpIydRWStxxR/jUZeQCinBiz63dcWX3rQs5QM3hzEo4Lzfv/aZ8YrrMkXB2M/+43rDj3 ySHx+em+zeMju0L5rOm33pQqlFeEepUS62LkjS7/56fIKQDA9dPMuvrwtaQR+gRkGOWz 3NpEWcyTh+9RIPv+jMVseqmE5IFWjMOAcjFg1YBOdLTifxXIrqXVLyrUD5MrkI4pNrnQ ooHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782313960; x=1782918760; 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=5O1SbVtatMzIgtgHChbbaSaj+UiSxNdbbreZyfkCgrE=; b=cT8ArKr8gEgfWWOMXC2l/KFP6SMUpmSwJCAnX/gWirJAErSCwiu8FRXTiIljUkJ7PZ rUKoA+0VuIipT6fBosl+WpUjLc2cAnSq6bsCAvYUJhD0lTM2BoX4ChRTFl689+Z0JOJY XH5UjhCW243Fx7X2hzl4/b400ohi6qI5K3aLpLpJlWc04kI/qFN5Pj4MLq+6cgJNDzZK WQfkgDfM2+lr2i2uM+XIDspiu8x+yrBCc6/smIiXqrC4QqgS5YjuLNpT1lJ/7bqy4KwI Ai0Yg9aB4KkOqBi2f5LswAMzFaePC4xg+HwLA2KzrdrdclJA94owLDE43YxKmfjRvvU3 dUeQ== X-Forwarded-Encrypted: i=1; AFNElJ8fNKB2sLJ+fMKDc0bdHeSNRelQw33xP/YvXJegvxwIS0YtRuzbeyeugpZeFqaLJNPfnwbc0lD6z+MU1yk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3rVkwvtFjjK29N7HXn7e8+jhXQjapehwCnF/OIaQ/c+pcjO7+ 96WRh6+H9NnjVPcRJHKgzUbWMat6mbXZq3strJ575Ftd+8NwaidQa3R4m1TGD3HdX/w= X-Gm-Gg: AfdE7cnHL0NWwEXuXHbW4k8ICBIffLm9IkmC1lfcHm2QPnCaxvZtK5wodvlf1rGKAbs aiOgaAQNIagx3Fdj9rneLUChteSlC3e+ulXsoozx6Cs2OhJtXkL9N2hoofzUYWKfHVQq+3OvGHU UOPSf9q8A8y23aN1MUYUW4qXKFxsh6Mfz1amtsI1ABlpLCMgloVX2mDOMJUOaCqrsALEYtbkgBr pZutIK+5BRDNNU6jfsFj5jQXszadPPwvFxK3R5ADjJR9dM1bcLRJZX1xJ0Y6yigb9YDNV3VKu9I 4l7vTGw+tFznTtjfPx2xZ5CCsuDO+9b+uyViH0Dyk2tL2h9ewU8OENLMb89R3gICzvtfbz5Q0Y1 trPiABmK9kWPXFdTF2DjjlUHdXFwU4aOAEfqUdyIDyjM0C8kwyd/wkb+u9ABCXWHclD5qftWkpe zNt5MQe88CJaJb9xUadqXD3A== X-Received: by 2002:a05:600c:4690:b0:490:5057:f5f7 with SMTP id 5b1f17b1804b1-492608532e9mr55199015e9.11.1782313960526; Wed, 24 Jun 2026 08:12:40 -0700 (PDT) Received: from vingu-cube.. ([2a01:e0a:f:6020:1b29:23a9:fb39:a3cd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4924944fbbdsm420357925e9.12.2026.06.24.08.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 08:12:40 -0700 (PDT) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, qyousef@layalina.io Cc: Vincent Guittot Subject: [PATCH 1/6 v3] sched/fair: Set next buddy for preempt short Date: Wed, 24 Jun 2026 17:12:24 +0200 Message-ID: <20260624151229.1710703-2-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260624151229.1710703-1-vincent.guittot@linaro.org> References: <20260624151229.1710703-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If a shorter slice task can preempt current at wakeup, we make sure that the decision will not be overwritten in between by setting the task as the next buddy. This still implies that the waking task remains eligible when the scheduler will actually pick the next task to run. Signed-off-by: Vincent Guittot Tested-by: K Prateek Nayak --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d78467ec6ee1..83bce5a04f3d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9903,7 +9903,7 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f preempt: if (preempt_action == PREEMPT_WAKEUP_SHORT) { cancel_protect_slice(se); - clear_buddies(cfs_rq, se); + set_next_buddy(&p->se); } resched_curr_lazy(rq); -- 2.43.0