Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2557149rbb; Wed, 28 Feb 2024 05:48:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFu+M6ct48dMB6APseZ/T3LyB2f6vDbLEdqDMcqP+X314Ns/u96NvBcVv9vvRUdclVYchxk80zzmU3n2THr/IzTcfqGj2S3TgKG+l35A== X-Google-Smtp-Source: AGHT+IEF6hRqoVC5IveAuRqtOdBuUg78WEdhYLfx44Rm0vBZd6fMDoOsz6CgQhBOJJONS7T4FVX4 X-Received: by 2002:a05:620a:2412:b0:787:f42e:99f with SMTP id d18-20020a05620a241200b00787f42e099fmr1132897qkn.12.1709128094097; Wed, 28 Feb 2024 05:48:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709128094; cv=pass; d=google.com; s=arc-20160816; b=Vmk5W5K7ZuOQXMm9DIpqhkAavnibxM0uCrFApRvj0cJfMFrbUwFpvaWaO5+Vr12yIP bFbxj5BgFfUKeyNEYySSsNTFp8ZfVszGyj0cyoD40HHex+EZSg6z1oHV8ZGAfZQ+PbZZ n0pZMxlq6IKhr/0AyNShS/Mf2rW6Lj1cuMTo5GYKU6ljmdV4QvBIQqifRl/ljyZnEADo Iv7ES/QGVXdfa6q9LfAbnIr1GPEOs04tQgpOO7GicvFesM9/NY5+nLH3C5zbNwL12fwv nc/t121gh3AZvetq7gtJPs/UY13pvxgj4wnHSsW+uLL3M/TPzJgLXujieu+7L2z7wgN1 as3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dF3BgAxPY8FDKy3zKrUrPlZUKXmTDH8+1bxpWFRIR3A=; fh=TaccX+wflKXnLP2HvkptaA5xSr9CbYBGIDg4PF626KA=; b=x9uRp7e66iaVfp2U1ztJGOt68BiNdpiLMJUcvKxxN3SUyo3gKbywL2Ktsn6reqgOPy NxiV+5N2WzKunBqVCmkTI4vCUnJb6eW7cJVRRJUr0RkcY2DedrTiDUmBvTgsslL68vjr d2DOKWYQQC46f0Xl/27NOtT3+aF6GM5QEltqlD4D6isLnhkTZ/KOiaHvpXIjhqiBBaAf /0k5r1Ox0Y2xa0JRrrokTInBo6e9wcptI9yz5GIFoq9Equfv8rjzRaehKeB9vx6c7idX dTpxAUTMAULu7MzjW+qsnihqfRkLs6yuNKe1VnsFJt5vG7uREYuzCb4GjU4FWNZrqj4J 5yRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bdu+d5PT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bj14-20020a05620a190e00b007871e086af0si10909994qkb.730.2024.02.28.05.48.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:48:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bdu+d5PT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9559D1C23B31 for ; Wed, 28 Feb 2024 13:48:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AEBA14CAB3; Wed, 28 Feb 2024 13:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bdu+d5PT" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0C31B14AD07 for ; Wed, 28 Feb 2024 13:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128085; cv=none; b=u+aHxxi9qucnm0h0hhaiaqhVqGqb+xNWp/Aup7cEUWcI+DyP+ovoJE4d/v2Ni7xuIJwjh3gUP/jxkfXW81CQIuYJE6R774ss9+FHTj5IfH2grKP36NPzIoiNCEp8EkVIg5O8UhB/Epq8tKVjN28VAlspLg+t/dpJvxe10TYcug8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709128085; c=relaxed/simple; bh=D7zDGT/oL9Z+7zb2o0ogH171hkdvTA3w4me6yNYvg+k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f6sOtZGt4rlRYWOrC/7AsSZ+HR+lovRAYDibiaq5XKMoSCA/tdQkr6ExPxOfaSaadafTdf+Igk6tItlu/0vYGOUGRJhY9FDlpjavbRuzHzqu2KlUPg0ja8/ITPgvn1ybGGz2r82ZZBUmdE2otEx4VGsQEYPzDkufyl/T4BJFhgQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bdu+d5PT; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709128083; 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=dF3BgAxPY8FDKy3zKrUrPlZUKXmTDH8+1bxpWFRIR3A=; b=bdu+d5PTy7t+ldUpkNjLBVlvElOxp5/I+ceQoBB6iJAYxZZXDtV+Xsl1W2Bnd0SgE0H5XF Px+ua5lhpbGClj5t4qosqGHurJdX+URTcZRFH+fRLTWtRCP3IM2a1SsS2rG8MPdtUd1rvi p5Vdqvkeo+oaINz8KcY4pODDnIqQgsg= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-gy7bK2C4O0um93KF85N4jw-1; Wed, 28 Feb 2024 08:48:01 -0500 X-MC-Unique: gy7bK2C4O0um93KF85N4jw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-787bd91c5feso414071785a.0 for ; Wed, 28 Feb 2024 05:48:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709128080; x=1709732880; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dF3BgAxPY8FDKy3zKrUrPlZUKXmTDH8+1bxpWFRIR3A=; b=SXmpzeQd8jeN44Gnsdant4iYEUxG9sgoA7LvFPXQczM/a2o4vcGhYBTR3l7u0O1slc y70LEjTU8EqkhLeIB3FaGdAl0MroxBWpeHYtjRl5M4/6yCNzx+fnpzTJ++vTrh2my4mE dOeEXCC6T6SOTkEAWTFGmX4ibmIzkuwpCWmx474d5BrDp0/PAF5ENv4YM8DTLZiC2ZKI V3bKN+TD/VmamDbNuvYIxXABxk64JjUjulSOY104kqajVSb1BryMcuZTE11qyG6X+SyE H8zphcFcLBBSRcrWkL/k19d/pH80fhDSmGHpjiB52BfmNa3AuviC7oxlELYsT7xVQCff HTOQ== X-Gm-Message-State: AOJu0Ywqsc5iSeEV2cd1jmvXR2Acgn6Ub6686zHBZpkRoIfYXzLSoRo4 rylD49RZ1is1gyvLo9zaotMG+9Mk+V2htsF/OFgv8OnahOaXToof3rtuj66AqO+ebBfuFsLY+pQ LbMaPyAjOiIQG4niMcFgaV8pAHw2hL/nUBIlkDkoHObAJkZcyNCNMPlISl8xM2A== X-Received: by 2002:a37:e104:0:b0:787:b0fc:8f12 with SMTP id c4-20020a37e104000000b00787b0fc8f12mr4918784qkm.3.1709128080592; Wed, 28 Feb 2024 05:48:00 -0800 (PST) X-Received: by 2002:a37:e104:0:b0:787:b0fc:8f12 with SMTP id c4-20020a37e104000000b00787b0fc8f12mr4918766qkm.3.1709128080223; Wed, 28 Feb 2024 05:48:00 -0800 (PST) Received: from localhost.localdomain ([176.206.22.187]) by smtp.gmail.com with ESMTPSA id j26-20020a05620a001a00b00787b93d8df1sm4615908qki.99.2024.02.28.05.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:47:59 -0800 (PST) Date: Wed, 28 Feb 2024 14:47:53 +0100 From: Juri Lelli To: Ankur Arora Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, paulmck@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jpoimboe@kernel.org, mark.rutland@arm.com, jgross@suse.com, andrew.cooper3@citrix.com, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, rostedt@goodmis.org, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH 23/30] sched/fair: handle tick expiry under lazy preemption Message-ID: References: <20240213055554.1802415-1-ankur.a.arora@oracle.com> <20240213055554.1802415-24-ankur.a.arora@oracle.com> 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: <20240213055554.1802415-24-ankur.a.arora@oracle.com> Hi Ankur, On 12/02/24 21:55, Ankur Arora wrote: > The default policy for lazy scheduling is to schedule in exit-to-user, > assuming that would happen within the remaining time quanta of the > task. > > However, that runs into the 'hog' problem -- the target task might > be running in the kernel and might not relinquish CPU on its own. > > Handle that by upgrading the ignored tif_resched(NR_lazy) bit to > tif_resched(NR_now) at the next tick. > > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Juri Lelli > Cc: Vincent Guittot > Originally-by: Thomas Gleixner > Link: https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/ > Signed-off-by: Ankur Arora > > --- > Note: > Instead of special casing the tick, it might be simpler to always > do the upgrade on the second resched_curr(). > > The theoretical problem with doing that is that the current > approach deterministically provides a well-defined extra unit of > time. Going with a second resched_curr() might mean that the > amount of extra time the task gets depends on the vagaries of > the incoming resched_curr() (which is fine if it's mostly from > the tick; not fine if we could get it due to other reasons.) > > Practically, both performed equally well in my tests. > > Thoughts? I'm still digesting the series, so I could simply be confused, but I have the impression that the extra unit of time might be a problem for deadline (and maybe rt as well?). For deadline we call resched_curr_tick() from the throttle part of update_curr_dl_se() if the dl_se happens to not be the leftmost anymore, so in this case I believe we really want to reschedule straight away and not wait for the second time around (otherwise we might be breaking the new leftmost tasks guarantees)? Thanks, Juri