From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 4231815687D for ; Thu, 11 Jun 2026 08:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781165960; cv=none; b=aR35uZSag7F1XWOUMFNwz2omdHhTPpAL7ivdTnciS3jvI5RB3s2bDGlsKCO8G+kVWt0OBkg7dzDDYr9109BS8pGNqvvskWL8DP4MOMwg9ynuyZr3h3rphyFMdIpeb2oT0Y0uw6YWwNVv4nFBHhhU82Ya1CgxIbC7T0jN6+6si4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781165960; c=relaxed/simple; bh=onThZ0ga/jgou++KH6WyWfkrZEkCkNzoFG2Y6cjMQ10=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZtCVcNT0u4IGSlOcbkBCrSMbpuF/7zodc7YdOxy/t5kfM+2drXIRL6vwa/UqeVZSwgAGvKdw10MImBXudk4By7SP+/Bn7WRKo3s893RHG+pP2czgEMPilLl0Y05bNSUHzha8ZXN1T8j8/RQeexY7hrLW10UGW61sXkzmq487wRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=drllNjP4; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="drllNjP4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vBi3aeLZUJRcFhB9llYYw8TsjkBR3Wu51mYB98IjQ2U=; b=drllNjP4ySEtErCv3vKeNQtVU1 FsgzfEPJmgN21ndR1ZGtwpX4hwwtpRUr2mgsrCJWSlpLg6LT7+w1sFf3HjrgcO2+KXtHWi60y6erA mmkY+47uFa65WHQDGIxGJxvuKco42NSBkmDcNqwwv4RSPHrJuAQoBJ4aH5vXtTK9pXZa7n2i//1Tv LDpQYSpYFzel32eZHrokClYoXJ01N2QcMaWhZngtawee4Cw6C8eaJ+wt143sDufExFh6lD9WEtonh m/UvxOjgPmdxLOZsLaNU/Wx9fU6EfJvVy+lsO65nLAvooKIYCzG9ms8VsGH2oUF9L1nQY/U9dMNVF bY0UiEtA==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.99.2 #2 (Red Hat Linux)) id 1wXad1-00000004wb7-2Y17; Thu, 11 Jun 2026 08:19:08 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BCD8C3002F0; Thu, 11 Jun 2026 10:19:06 +0200 (CEST) Date: Thu, 11 Jun 2026 10:19:06 +0200 From: Peter Zijlstra To: Rik van Riel Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH] sched/fair: clamp rescaled vlag in reweight_entity() to bound entity_key() Message-ID: <20260611081906.GI48970@noisy.programming.kicks-ass.net> References: <20260610105529.14e014dd@fangorn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260610105529.14e014dd@fangorn> On Wed, Jun 10, 2026 at 10:55:29AM -0400, Rik van Riel wrote: > reweight_entity() preserves an entity's lag across a weight change by > scaling vlag in rescale_entity(): > > se->vlag = vl' = vl * old_weight / new_weight; > > and then, for an on_rq entity, recomputes: > > se->vruntime = avruntime - se->vlag; > > On a large weight decrease (w' << w) this inflates vlag without bound; > nothing re-clamps it to the per-entity lag limit that entity_lag() and > update_entity_lag() enforce everywhere else. The deadline is rescaled > and re-based separately, so only vruntime drifts. So the vlag limit is: limit = calc_delta_fair(max_slice, se) Right? But that is in fact: max_slice * NICE_0_LOAD limit = ----------------------- se->weight Now, rescale does: vlag * old_weight vlag = ----------------- new_weight So then transform the limit using that same: max_slice * NICE_0_LOAD old_weight max_slice * NICE_0_LOAD limit = ----------------------- * ---------- = ----------------------- old_weight new_weight new_weight IOW, the transform totally preserves the limit. If the vlag was bound before, it must be bound after. What am I missing?