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 6CB84EE7FF4 for ; Mon, 11 Sep 2023 15:04:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C44186B02B1; Mon, 11 Sep 2023 11:04:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF3FC6B02B2; Mon, 11 Sep 2023 11:04:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE3A46B02B3; Mon, 11 Sep 2023 11:04:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9E8986B02B1 for ; Mon, 11 Sep 2023 11:04:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6FDA0140A96 for ; Mon, 11 Sep 2023 15:04:58 +0000 (UTC) X-FDA: 81224639076.30.399719F Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf21.hostedemail.com (Postfix) with ESMTP id 458741C0017 for ; Mon, 11 Sep 2023 15:04:55 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=Za0ofSf5; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694444696; a=rsa-sha256; cv=none; b=4QNn+rDF5WV6oYOGRLW5px2EZVGBr42IekaxUebHBpnOR6xVRUSshu2mY7wXfGwiQ8V8/O fqaAPmw2IcNW/MS102lWg5BwT+TtCHgzT+jfx/pOX374rflwSMZ6Cao0fgyWekaiWwhpcR vXoU1iCde83Wrf6vpJNQXCA1MvEy3iY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=Za0ofSf5; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) 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=1694444696; 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=/tHifxU4D/kPyGjpOI02IN1gWwytnQQSgtFJSuo6bxE=; b=RGCWesP5Z/no6uwlLGTdMU8B5onWio5rXvpXWuSer0qNsYNBe52+aVkW7qY6/sntuJhzql MIh4atEmpEGLt89f+jYWZaQdDCDMBX02cX5rVs+Li0efBO5s5See8xyW59IkzYLQcuIKtJ spN+BQLTPrFBJYaU43mHBDz3FGpkPRs= 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=/tHifxU4D/kPyGjpOI02IN1gWwytnQQSgtFJSuo6bxE=; b=Za0ofSf5X9r5Y5JVDdtrBM2RMz H++Qqgf2yVdOQBA5J9bgHFhGyM9HPz2P93Q+n4bV0oQma2kd+pVFS7/LhJ4I/nIirRQW0yqPN8MYH izYtoJu/JrBguKJORrMBgoT4lvzjQlTsiGjGKTildbb+YRFHuLfVylnawjRmwz3/6p+JebFBC18+I 1mrgz+/DbDWwgKWVLijXJ77+2KG1sSTAtmRhrOUsX1s4c3fmNZ71F61gccbpcwhWeVTkan54CRhOp 13a7usPu2pKE9dINl8TnBTS8KKDJZkLs9xfxYtMqtWpkjUoM6Q9xjkAdZjxAGIG3GFawsmFJMGvLw lw5KVIMA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qfiSP-0054Av-0c; Mon, 11 Sep 2023 15:04:11 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 45BA43005B2; Mon, 11 Sep 2023 17:04:10 +0200 (CEST) Date: Mon, 11 Sep 2023 17:04:10 +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, jgross@suse.com, andrew.cooper3@citrix.com Subject: Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED Message-ID: <20230911150410.GC9098@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> <87zg1v3xxh.fsf@oracle.com> <87edj64rj1.fsf@oracle.com> <87zg1u1h5t.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 458741C0017 X-Stat-Signature: 41wgqnqb8481rsmh89i3ihf4fsiu9hww X-Rspam-User: X-HE-Tag: 1694444695-752131 X-HE-Meta: U2FsdGVkX1+5hFgjECT4tV64S080JqkR+Hr/7vOg61VVTD4o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lud0jtaG3TJcoPybmjFupYpmd59IoKMVHuWkqQCHInA== 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 Sun, Sep 10, 2023 at 11:32:32AM -0700, Linus Torvalds wrote: > I was hoping that we'd have some generic way to deal with this where > we could just say "this thing is reschedulable", and get rid of - or > at least not increasingly add to - the cond_resched() mess. Isn't that called PREEMPT=y ? That tracks precisely all the constraints required to know when/if we can preempt. The whole voluntary preempt model is basically the traditional co-operative preemption model and that fully relies on manual yields. The problem with the REP prefix (and Xen hypercalls) is that they're long running instructions and it becomes fundamentally impossible to put a cond_resched() in. > Yes. I'm starting to think that that the only sane solution is to > limit cases that can do this a lot, and the "instruciton pointer > region" approach would certainly work. >From a code locality / I-cache POV, I think a sorted list of (non overlapping) ranges might be best.