Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2492558rdb; Wed, 21 Feb 2024 09:10:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWzWhdW2Pp1KO0fXk3TFF6q87G4bYhgkeAT0wjXlPWDL6HDGqeOSLEb9rOiqK7vZlzZ2fQu2xjBlklupXQWQPy97bEOYSeLasDKMlFikg== X-Google-Smtp-Source: AGHT+IHKpgKrz6KCG/xoYXN4cMwgKFd7249HWX7kFDBxZi44/WVfri0YEDbBxmj9laWAbTL1CD7w X-Received: by 2002:a05:6a21:3513:b0:19c:aba2:69e5 with SMTP id zc19-20020a056a21351300b0019caba269e5mr22496472pzb.45.1708535454950; Wed, 21 Feb 2024 09:10:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708535454; cv=pass; d=google.com; s=arc-20160816; b=EYEdABZCWUv6MFx8BOnEIDB1FUHZOUAYuiXJL+IB6AigiwKLvEeTuGqGlWU6+L4g5O DpbHNW8W/7Zn2SlbSCvGd6SCNJ5mz4BYIpFEMnWVTQVqZ5K71VeSFQunTO2gQDbjPk3G 21LGo1fSk4PuqNJs90xsV+I0oX07gVUiOfDPVqqu25OI96aXtCMWYMogZLOfBf+LzSZN QUrCbbFJfWnDIo52S8WJGYcOXIhvXELdwqnCJQCoxfCg5cd1lkyBnI3KF9ZsLVXHfAZj 36+6QSr9tDhbh+BV0fRPkzSV/ktqto8FAEnUkP2mVQDTcvFGx4hIxcm+RnzxEJ/HuuE6 lGcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=bw+z6sQUFE3Xg4n/9xU9BAzIHIwZ+UW1Dx+6qEYqlaw=; fh=vC6hqP2dYpDL5D+BDXtTpiPLC5v5/Zl32aPP3Z/AnIc=; b=VyazhDPJ2HBzXevjnEBeBfzgMop17MolmrPnm4l143Tb3XSxyTFEQSJsrw2FVIjjYv 63htiOeGR/56cFx05YmVn5uBLoVpgk+Yw4XFT0fDWZnUrQmYS+Uo/YVB9ytvB7ZJriZy CjLGJpz8uCosqMmScYY2VEjiEaLpvru5UBfGr21uKBdHILc/d07SDCLeAOIZxib/VhpS PiIuheX8as9zwRDsh60Gtwo11vqbCchIe7jDnjez8NfOb+ZG6UsGMMSjlf08T5jgntpK gkblutLBBKSKEY9tOoZaniFuEqX6BINwoBK86oiBF1Md/HVRhAB6kVMQajcDCEwMAG7g IA9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=E9RcVRpR; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-75169-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h5-20020a625305000000b006e475352d12si4202796pfb.285.2024.02.21.09.10.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 09:10:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75169-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=E9RcVRpR; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-75169-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 242FC2851D9 for ; Wed, 21 Feb 2024 17:10:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E33B283A09; Wed, 21 Feb 2024 17:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="E9RcVRpR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="t6lfnyh/" 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 C1849839E5 for ; Wed, 21 Feb 2024 17:10:46 +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=1708535448; cv=none; b=Qoxfui/8/Cwbt6dWLUD4y3puyChvxGLMU0079rzYdSRcOfMdKpskBeKClmjODi5i+YrIfvfSNHWp50Z6qrNFdz73cLyKAygweUIlSh8Z5oGkaSOlNiX3dhXYmA31oQaUi7a4/sChac31u4vDT9aGzgh4B3FrStqmlX3UtQo6bMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708535448; c=relaxed/simple; bh=lR0rMh24z0ylg10w0OvDGiKJ0KBzucjbMGKtOl1x7l8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Bfz7NhwZpyE4XIRrxSpF+cD9OvgcO1jqPwmaO4X4u2wfXuPRJQCoZumpr+B53253wJ9rUYPUebuI3bBG+G8jfS/H24HOad1ygmDXD4DF+Brb9MU0k9ET8rnKPCG5OA53POKmN9UlTkhNfJ+q9+cr1bk29W7NX2llolDdjsdK26w= 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=E9RcVRpR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=t6lfnyh/; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708535444; 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=bw+z6sQUFE3Xg4n/9xU9BAzIHIwZ+UW1Dx+6qEYqlaw=; b=E9RcVRpR6ZIyljiI6aE47VzQ92MVBrGvNSF6NhWN2BeFGT2cxsy2q6nzXZy/UkI1Ynf1BX aMEis9oAIsKuX9pg/HP3JHahsvyiJpKWnNizuUaBjFwEJBmGQoOlC2nPonGApWrh+kNn99 R3hIyTQ44Zo5QgGmRoFM+elIHiLKxd3tUrfSFi+fMCs0tXl2+9M+gisxEolT1gYmz1lort nFg/bADY4MXDyo995hUlxVUDdOHBxZBb58YJiKlIehnjER5/SAzbDKNkPEUszxVzpEuerR rzK73CqlY/+iZA5eesEVZ0ysfnJ80ILTt+cSCLXx1HYY4HHIYA7+CW0k/3jHRQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708535444; 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=bw+z6sQUFE3Xg4n/9xU9BAzIHIwZ+UW1Dx+6qEYqlaw=; b=t6lfnyh/tQPkJyVt1Mb22bEW+7j3QlmocvY72SqukEe2Zj2KJ4zXUGCqrKtYmTpviCS1tx GfI11SXZUhpAaICQ== To: Ankur Arora Cc: linux-kernel@vger.kernel.org, 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, juri.lelli@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, Ankur Arora Subject: Re: [PATCH 05/30] sched: *_tsk_need_resched() now takes resched_t as param In-Reply-To: <87msruiwz6.fsf@oracle.com> References: <20240213055554.1802415-1-ankur.a.arora@oracle.com> <20240213055554.1802415-6-ankur.a.arora@oracle.com> <87sf1o8oh2.ffs@tglx> <87msruiwz6.fsf@oracle.com> Date: Wed, 21 Feb 2024 18:10:44 +0100 Message-ID: <8734tlhhez.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 On Tue, Feb 20 2024 at 14:37, Ankur Arora wrote: > Thomas Gleixner writes: >> On Mon, Feb 12 2024 at 21:55, Ankur Arora wrote: >> >> The subject line reads odd... >> >>> -static inline bool test_tsk_need_resched(struct task_struct *tsk) >>> +static inline bool test_tsk_need_resched(struct task_struct *tsk, resched_t rs) >>> { >>> - return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); >>> + if (IS_ENABLED(CONFIG_PREEMPT_AUTO) || rs == NR_now) >>> + return unlikely(test_tsk_thread_flag(tsk, tif_resched(rs))); >>> + else >>> + return false; >>> } >> >> Same like the others. This wants wrappers with now/lazy. > > So, when working on the scheduler changes, I found the simplest > implementation was to define a function that takes into account > current preemption mode, checks for idle, tick etc and returns > the rescheduling policy, which __resched_curr() carries out. > > So, it would be useful to just pass the resched_t as a parameter > instead of having now/lazy wrappers. That's fine for specific functions which really need to handle the rescheduling mode, but for all other random places having a nice wrapper makes the code more readable. Thanks, tglx