Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2001250pxu; Fri, 9 Oct 2020 05:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNqXvUMw6duc+lp0UWGeFnh+769xfCOnyy3Y1xACEgppxTXvyN722lB3OT8zLlSGA46vRU X-Received: by 2002:a50:e042:: with SMTP id g2mr14514250edl.314.1602246970888; Fri, 09 Oct 2020 05:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602246970; cv=none; d=google.com; s=arc-20160816; b=oYX6OUVuAdtFjn98ckXY7Nf/wNFXlj2cOC4H02sWkJ5HiYZaMaf8yd/BmTbN6uZgHD J07E7/MMu5Jq4ActSFHe6n1X9uAy70vRlcM0IEbvau24K4R4CBJ/210EpjwNMMEc7l4z V6Hl776wqQKsFx0TYFznJRflJt2Prj+O4FWtw8YZD/ZDJXbvABpgce82rHtOWT02qBnC Hh7Pm7p1Ha4VUvfn6eHaNMRrqey5YuBOXxzscJj2zZ21IKJZ9SC2iJgBGGYJ9e0unv8K 11cCyrWDi/H+XzZOVBEZ5JnL6GTVmTwHfUZjN3iN0eDMjamjO6sM8ObuJTnCTPA2wT3u sbLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0tqihfBLiXgPDJi1ekdIOztDjl+mzaS5KGF/0r87WZ0=; b=EclZwVKe8uAe2rRI5ZOdLPXkai75tBoch5SnXl71OVWMgWRvmMM6WAftU8/wmezXUT 617r77DuRRqDlNCnAdhS3yYNCvo6zPLNGNPrceXk+3yR3cb0eNK/c7u41ab++G7wasEQ 8PQMfvdTfW+Mtp7jVJbBYlHAGtl8Fg/WVEKSDTpyCVUH3EFMS6naNYNNKYNfZBoYe1z0 aePqT4DoPrbynGozBrhuJyrfwx41CUOlRdvijw7/w3qI1iYbIJyg8BR3YqgopfJFoJaG 0iH5Qy6W+k2pzY9vlU/iOl+OzxqVEwu7p3Yo+bUvKcVdjbIojDeIG7pDk/TuGP5hbXoA E3jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MItc3sFk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h19si5939281edv.197.2020.10.09.05.35.48; Fri, 09 Oct 2020 05:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MItc3sFk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387517AbgJIKOI (ORCPT + 99 others); Fri, 9 Oct 2020 06:14:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:42030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726357AbgJIKOI (ORCPT ); Fri, 9 Oct 2020 06:14:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602238446; 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=0tqihfBLiXgPDJi1ekdIOztDjl+mzaS5KGF/0r87WZ0=; b=MItc3sFksd0/4NJ7hYjcj65feAlbGMeXZtuJYczhV06Uc2iBIESzaj5RwMzXoh/sG1nw2U JdmpwZ9DB8APvgjajEsA6vrlRUPOSzV/jZakF9dEsIVW1xwEfZxZ9ZI1/3/ezALVk3EDIH K94ySLid06ofGMXAESDYkhTZX/Xc3DQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A0E1AADF5; Fri, 9 Oct 2020 10:14:06 +0000 (UTC) Date: Fri, 9 Oct 2020 12:14:05 +0200 From: Michal Hocko To: Peter Zijlstra Cc: Thomas Gleixner , Frederic Weisbecker , LKML , Mel Gorman , Ingo Molnar Subject: Re: [RFC PATCH] kernel: allow to configure PREEMPT_NONE, PREEMPT_VOLUNTARY on kernel command line Message-ID: <20201009101405.GI4967@dhcp22.suse.cz> References: <20201007120401.11200-1-mhocko@kernel.org> <20201007122144.GF2628@hirez.programming.kicks-ass.net> <20201007123553.GK29020@dhcp22.suse.cz> <20201009094741.GH2628@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201009094741.GH2628@hirez.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 09-10-20 11:47:41, Peter Zijlstra wrote: > On Wed, Oct 07, 2020 at 02:35:53PM +0200, Michal Hocko wrote: > > On Wed 07-10-20 14:21:44, Peter Zijlstra wrote: > > > On Wed, Oct 07, 2020 at 02:04:01PM +0200, Michal Hocko wrote: > > > > I wanted to make sure that the idea is sound for maintainers first. The > > > > next step would be extending the command line to support full preemption > > > > as well but there is much more work in that area. Frederic has promissed > > > > to look into that. > > > > > > The sanest way there is to static_call() __preempt_schedule() I think. > > > > Yes, I have checked the code and identified few other places like > > irqentry_exit_cond_resched. We also need unconditional > > CONFIG_PREEMPT_COUNT IIUC and there are quite some places guarded by > > CONFIG_PREEMPTION that would need to be examined. Some of them are > > likely pretending to be more clever than they really are/should be - > > e.g. mm/slub.c. So there is likely a lot of leg work. > > The easiest way might be to introduce PREEMPT_DYNAMIC that > depends/selects PREEMPT. That way you're basically running a PREEMPT=y > kernel. > > Then have PREEMPT_DYNAMIC allow disabling the __preempt_schedule / > preempt_schedule_irq() callsites using static_call/static_branch > respectively. > > That is, work backwards (from PREEMPT back to VOLUNTARY) instead of the > other way around. My original idea was that the config would only define the default preemption mode. preempt_none parameter would then just act as an override. That would mean that CONFIG_PREEMPTION would be effectively gone from the kernel. The reason being that any code outside of the scheduler shouldn't really care about the preemption mode. I suspect this will prevent from dubious hacks and provide a more robust code in the end. Does that sound reasonable? -- Michal Hocko SUSE Labs