From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 219FD1DD86C for ; Mon, 28 Oct 2024 13:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730121639; cv=none; b=ZzukhYjU+fLl2kmFHy+dyF63YTEFvM+Q03hCwKifDQg6hIUE0G8Q8nCf23GC2xKZBCM8rDpI8UEleONfIwblGwdzYMjGt36LaJek1FOUhtOk79XByRBUSznz3++i96vVU61KxY6MAhLRiPL0QiAkne7Fqfi751lZNHDItegMIjo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730121639; c=relaxed/simple; bh=Suwv9Pz/ODA+4gDt8HzisNZt+p8mAGn9UIo7CtFSq5o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dSE0tx/X7N5Xh/P7XGMke07htWVVZIlVYpAhsF4MGo/aAy4HBijOs5lAer4++xvecGyV9g+hSDNIf1Suy9Q2jddIometHC50cI7kFTpiuczK+5R8wcZDwoBRhMgzflkGz+7jNVuUHBp7tJDbPzryvgkPl6tDHUXkCp2ZtFBwlQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RZkIo/WW; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=C4M/VMf/; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RZkIo/WW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="C4M/VMf/" From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730121635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dO0Sbf4gVFSLA8fH2N1EVtb3XGzxJuTgSp+ujywVrwA=; b=RZkIo/WWb7KARcBBajXuPqH8VfyA1KQSxKizF+j7w2Nqq+kaDdyiipuGCpd6FgiNo+ViAL C2ILFljJXfnwCFpHlR7EUAhpaTmft1V2czR4ilA7xRjmO9qyKtUZwSOoT3KP03hzH7KY+0 ZDmJ+fU1lldl+nDfiM0iZ5DpFAHXIzf3D6lQJITRDAGOHhbV1cxhlFGUgpuPFzTJaTdiO3 w+fbZ8JAIOAPP1QRWLGXDO/8095mDzzySUETklmv4ocZ4f9As6OEGP3MzWVexPB5XeIUM9 17WJLFxd0LDNjipvzRJBeZEDeB30OZrd2SBMAZNGKIRrFcWUt/2HDQPf/ushSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730121635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dO0Sbf4gVFSLA8fH2N1EVtb3XGzxJuTgSp+ujywVrwA=; b=C4M/VMf/ettOBTsBj8TKTzHNFm7MqoPZm/Hn44/n3OOJBNoHprePvbI6ioO0A00p2WaeMP 4zfE5jRoQQAWg4Bg== To: LKML Cc: Peter Zijlstra , Tejun Heo , David Vernet , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Ingo Molnar , Rasmus Villemoes Subject: [patch v1A 2/2] sched/ext: Remove sched_fork() hack In-Reply-To: <20241028103142.423153706@linutronix.de> References: <20241028103006.008053168@linutronix.de> <20241028103142.423153706@linutronix.de> Date: Mon, 28 Oct 2024 14:20:35 +0100 Message-ID: <87ldy82wkc.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Instead of solving the underlying problem of the double invocation of __sched_fork() for idle tasks, sched-ext decided to hack around the issue by partially clearing out the entity struct to preserve the already enqueued node. A provided analysis and solution has been ignored for four months. Now that someone else has taken care of cleaning it up, remove the disgusting hack and clear out the full structure. Remove the comment in the structure declaration as well, as there is no requirement for @node being the last element anymore. Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class") Signed-off-by: Thomas Gleixner Cc: Tejun Heo Cc: David Vernet Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall Cc: Mel Gorman Cc: Valentin Schneider --- V2: Remove the comment in ext.h (Rasmus) --- include/linux/sched/ext.h | 1 - kernel/sched/ext.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) --- a/include/linux/sched/ext.h +++ b/include/linux/sched/ext.h @@ -199,7 +199,6 @@ struct sched_ext_entity { #ifdef CONFIG_EXT_GROUP_SCHED struct cgroup *cgrp_moving_from; #endif - /* must be the last field, see init_scx_entity() */ struct list_head tasks_node; }; --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -3548,12 +3548,7 @@ static void scx_ops_exit_task(struct tas void init_scx_entity(struct sched_ext_entity *scx) { - /* - * init_idle() calls this function again after fork sequence is - * complete. Don't touch ->tasks_node as it's already linked. - */ - memset(scx, 0, offsetof(struct sched_ext_entity, tasks_node)); - + memset(scx, 0, sizeof(*scx)); INIT_LIST_HEAD(&scx->dsq_list.node); RB_CLEAR_NODE(&scx->dsq_priq); scx->sticky_cpu = -1;