From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2379EEB570 for ; Fri, 8 Sep 2023 22:50:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 260606B00FC; Fri, 8 Sep 2023 18:50:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E84E6B00FE; Fri, 8 Sep 2023 18:50:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B2256B0100; Fri, 8 Sep 2023 18:50:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EBCDF6B00FC for ; Fri, 8 Sep 2023 18:50:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C0DB5A03BF for ; Fri, 8 Sep 2023 22:50:39 +0000 (UTC) X-FDA: 81214926198.30.25957B4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id B3D34A0035 for ; Fri, 8 Sep 2023 22:50:37 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ilKhM7+2; spf=none (imf15.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694213438; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fZXJRL8nPOvN6Vw7zQ/cvPU2e3LHsiOLniAY/2LW660=; b=USwJaYFBhe+YlU7q8+atgFen/fp5jQf2wSz24o7Ff8tJGV/5bjYgWjnDR215IubNYtp3YF cwK78tzXd/m1O+f6vlUu8ufOONtQ4PSVja9J4BRSbDum1HiNHuqeM4szG98P8Erwahgy7e csHHten7ejUgYYl4r8/iANoOrQjgzF8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694213438; a=rsa-sha256; cv=none; b=SOAm7iA2VjjRXhT385IEvj7/CsoQsW5ELhIlw43Jqt671EER463GPhBtIsV5y8mL7im5Pw ht5MQAD8yVvUwyiA+KCUEmLmsghdyA9+T5qcGKeccimeu7SrPKAZWYsEMHYu8edAvDPgrr Hqd1JamxDcdmVI2AVDrc+HCR8WcYdHA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ilKhM7+2; spf=none (imf15.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=fZXJRL8nPOvN6Vw7zQ/cvPU2e3LHsiOLniAY/2LW660=; b=ilKhM7+23C7sjucxSsPzHD7Y4G 4Ty+dzfIrbLlBmVx5veFESguTyVeih5qhjP1+wbu/0Wnj8iB9521UP25t3pZ23aw8LAid5xMEgV2b DgQM/Ufdfs2H5gAP/nFCvLoWvWleeY9rUyaXr/dLzsqCZKHfsPhuNW9d21Dtx6eSIAQdEE/lXH979 jnRVqYPOkahdTGWgUnaivBjmuj94OojgWE1m+d6SOHQhwj8VCzEvlRe65/chc6cC3TtCVG1+PoI8W n+1Gnr0Elfb7yYx22KAEe87xryKpP+EL8SHmnEVWH1uNQdHzRLvNGEl3Aj/uwjecqLkIjFqiR3X+K W41Os04A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qekIs-002nUM-FC; Fri, 08 Sep 2023 22:50:19 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 202E8300353; Sat, 9 Sep 2023 00:50:18 +0200 (CEST) Date: Sat, 9 Sep 2023 00:50:18 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: 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, willy@infradead.org, mgorman@suse.de, rostedt@goodmis.org, tglx@linutronix.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED Message-ID: <20230908225018.GB32012@noisy.programming.kicks-ass.net> References: <20230830184958.2333078-1-ankur.a.arora@oracle.com> <20230830184958.2333078-8-ankur.a.arora@oracle.com> <20230908070258.GA19320@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: pzopmf4t7wsgkxtwfjx11wnj7ox63uwd X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B3D34A0035 X-Rspam-User: X-HE-Tag: 1694213437-346308 X-HE-Meta: U2FsdGVkX1/O2EztC3/jPtURhCUv4heiiXau4xvP+wC5jQl1M3McSn1h7Jtyzr/+WthQVrmxde0Few5PzzTjspOy2/kZjtH9egEPfu4A+4FWk7m8NfMcLjl/TjwV3dvh2DVmVTrzxv07cmVpAWS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tVssPeimitT9I51KfzNEQ7vujW5yYNqMYWPcVpdU9R2SXlxUv8g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 08, 2023 at 10:15:07AM -0700, Linus Torvalds wrote: > On Fri, 8 Sept 2023 at 00:03, Peter Zijlstra wrote: > > > > Which on a PREEMPT_COUNT=n build will cause preemption while holding the > > spinlock. I think something like the below will cause sufficient > > warnings to avoid growing patterns like that. > > Hmm. I don't think that warning is valid. > > Disabling preemption is actually fine if it's done in an interrupt, > iow if we have > > allow_resched(); > -> irq happens > spin_lock(); // Ok and should *not* complain > ... > spin_unlock(); > <- irq return (and preemption) Indeed. > > which actually makes me worry about the nested irq case, because this > would *not* be ok: > > allow_resched(); > -> irq happens > -> *nested* irq happens > <- nested irq return (and preemption) > > ie the allow_resched() needs to still honor the irq count, and a > nested irq return obviously must not cause any preemption. I think we killed nested interrupts a fair number of years ago, but I'll recheck -- but not today, sleep is imminent.