Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp597338rdh; Sun, 24 Sep 2023 04:02:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5WMQiDwz0FHyG5yzyPvhq3pbge67+A5f5189ILMFJE5RrMEqvWdj/gOQ0k2cfH02HdkQt X-Received: by 2002:a05:6a00:24d1:b0:68f:b5a3:5ec6 with SMTP id d17-20020a056a0024d100b0068fb5a35ec6mr6873754pfv.0.1695553330898; Sun, 24 Sep 2023 04:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695553330; cv=none; d=google.com; s=arc-20160816; b=X2Pay75b52J62BH9s7tXehXtsZjN1Hjwsf4rm0Zwi4vq8/9fuEDki659C1tH9Z1z5G 3d1MIeQqfo0qewNEts4aXEST4OMglYhtJGRQKJPFYMY6X/0BXjyiDVHbfQ6MHQ/gfZub kMcaKBb2ei6fT26LDLGl2zRvB2R0FVD/JRoVWk8fPUPulgyQwVRRSW+ZTbddv4jxPZBY 7DSoI+b+Xi+fpIzkEOeAVRMLqYyo/wzUwOzkj7CFnLkvQjnSMhl2HNANateRWHIjhQMX FXTAL36iX14rTP8Ih0wc7TNhX3NYgQbxLyL1RLfculvRS35WkNhzhcNyByMp5lg/iALH O37g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=uJ3bFtBX+xFFyPEDv2OXIlVM2+4Lakum4JeZyJHofeI=; fh=O8ZITzts4Y/pkmKPnAOuuppk05d1Y56BU5UNTQFerl8=; b=hZtINWCK45GFnnvN8F5n8Fm69O5uuN9QLtqxmLU5x0aid51069o/BIU4go89E41En+ NVQDTUMgzpsXKbik8GQKRsfPeBNivUvCrujRBIJ09mydLCUqEwcGlqC7CC8fqEfHm+NE SP4xYjj8KQGAIN8UX7AFgheLgA1dduQc9a14bN0Mq+3l9dWjBK4iY97hcy5b9Z97sbK5 g3XA+1tEMIBzu8EMziW4X/jHvkWUoS5JpDV6b518KfCDGD4Il40E4ro9tPRAo8Waipp+ BClmC4pA4mf1ThnUiizRwzUkgQPx8g7E2gVquD6x0jXV9kJ8Xb4qVG0w0aOPEP5YmYYt 2GCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zHuPw4Ap; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a72-20020a63904b000000b00578e4c1581bsi7677026pge.866.2023.09.24.04.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 04:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zHuPw4Ap; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 70A108026ACE; Sun, 24 Sep 2023 00:56:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbjIXH4E (ORCPT + 99 others); Sun, 24 Sep 2023 03:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjIXH4B (ORCPT ); Sun, 24 Sep 2023 03:56:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E463106 for ; Sun, 24 Sep 2023 00:55:55 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695542153; 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=uJ3bFtBX+xFFyPEDv2OXIlVM2+4Lakum4JeZyJHofeI=; b=zHuPw4ApKlRAWEypkg2Ve2Sy10ibX4+DZ70jnonQBEKLHvmpsHiMnB3qY8Ptn9x8IXhsbp dTwyZRWqSYsKgYCKcXcsSbUEwUAVsztza7s1lZpOoxM6sCbTsteIBQjZlizQJWhfCafwrN pzVTughblLnHUMkupvN78oBWNzgMUMZGyyTXCh7b1PJtcX5fmKh8+hx3JDSW+fAQVjBJSj 9IgK1PeZpjTb8BH/L6dJWcVPXNXaXzyimebKYLdUq9iVAXMiSH/pcHIh1/u0s78CWZezw2 HadSQjFkQvt0w+DeLsLQyxFpBuZhoxrEhbQJ3HTM+xumQBVE+/kMft8bMrh9Dw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695542153; 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=uJ3bFtBX+xFFyPEDv2OXIlVM2+4Lakum4JeZyJHofeI=; b=BTG/KIxfrzyYh56D/+yZfbnO+4ToZq5D5hFTY9eyiGzvurxE+tWRjSOgX7QEuQMYxFgZAq W7nsrZV/qTBVZQBA== To: Matthew Wilcox Cc: Linus Torvalds , Peter Zijlstra , Ankur Arora , linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@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, mgorman@suse.de, rostedt@goodmis.org, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com Subject: Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED In-Reply-To: References: <87zg1u1h5t.fsf@oracle.com> <20230911150410.GC9098@noisy.programming.kicks-ass.net> <87h6o01w1a.fsf@oracle.com> <20230912082606.GB35261@noisy.programming.kicks-ass.net> <87cyyfxd4k.ffs@tglx> <87led2wdj0.ffs@tglx> <87h6nkh5bw.ffs@tglx> Date: Sun, 24 Sep 2023 09:55:52 +0200 Message-ID: <878r8wgg3b.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 24 Sep 2023 00:56:12 -0700 (PDT) On Sun, Sep 24 2023 at 08:19, Matthew Wilcox wrote: > On Sun, Sep 24, 2023 at 12:50:43AM +0200, Thomas Gleixner wrote: >> cond_resched() cannot nest and is obviously scope-less. >> >> The TIF_ALLOW_RESCHED mechanism, which sparked this discussion only >> pretends to be scoped. >> >> As Peter pointed out it does not properly nest with other mechanisms and >> it cannot even nest in itself because it is boolean. > > We can nest a single bit without turning it into a counter -- we > do this for memalloc_nofs_save() for example. Simply return the > current value of the bit, and pass it to _restore(). Right. That works, but the reverse logic still does not make sense: allow_resched(); .... spin_lock(); while resched_now_is_suboptimal(); ... spin_lock(); works. Thanks, tglx