Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp705603pxk; Wed, 23 Sep 2020 13:57:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ/GMbSuG0hxG7YsyfRqBV7FnNgRCF3JKkSh/u7HM7hk4ONoJTLi50GBNPFAkWqalLNkEh X-Received: by 2002:a17:906:b88e:: with SMTP id hb14mr1402946ejb.543.1600894640175; Wed, 23 Sep 2020 13:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600894640; cv=none; d=google.com; s=arc-20160816; b=ZUOvj29jdqPMekpYDNtwX/Ypmpd3XbvAaF8IadGY6dOlCBgcQf7P0WCyGW8WMLGFzS iA92kwOGXum/hzwaS0s+YU1/iasxkSssZwp4f75U8Qn+5A7GsXfsGgiPS5nack/IvaNw 9ZlFcz5tJ+SoOkJl01mkhUFHT74prkNwU+0dxnIX1iroVCwdsCXU+yirGV/OYPdBbUPo vADg2TJKs3hCclfWy46i3azldrPFaeNv9uTHGDy90FZSkblNhCHUOulxyXjx1hjNrSix NG7djPD1EqtB3puKqeAx8PnNvFuAE954TsCI3HOOihi8cec0936Piq9Vc1Zn6cryQYLg GD+g== 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=l2WJ9VY/ovlOeTamqA6hSSk6rkurGuhlcvh+V81qWPQ=; b=f088mAvMgvyR9Gx7+aQUUOEZ0wsTCv1LPiV0jBq5UIbKcXqtTLMc6/RbgCIbfFBUwj 861MfOiYH7yKWV113NXwXCXERNWuUiz4wIxS7ufcW1+LDREJ7yFHCh60NAu2HLehFg2p QH8dWM4uedazmw8TDU5NmANpAzF49mk7gmEBOH+WyVuxP4BK32kMmuxPHTDY8OE3OLty iCdJEd4RRfMiZjm5CrG5fcZJnK/qKbzwZxU2i4kVxfZsy+y1KVS8bqFw08yX2LYO7xb9 JcdRjQvDTHOQ9qYwgU7dUClg8IpdetMcfxvNNZbZK3Pj3eWXMimms0Oxpzwso8YKVxEN iBEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KMxSh7B9; dkim=neutral (no key) header.i=@linutronix.de header.b=2urhFSWh; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si656627edw.559.2020.09.23.13.56.56; Wed, 23 Sep 2020 13:57:20 -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=@linutronix.de header.s=2020 header.b=KMxSh7B9; dkim=neutral (no key) header.i=@linutronix.de header.b=2urhFSWh; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbgIWUz5 (ORCPT + 99 others); Wed, 23 Sep 2020 16:55:57 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40710 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbgIWUz5 (ORCPT ); Wed, 23 Sep 2020 16:55:57 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600894555; 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=l2WJ9VY/ovlOeTamqA6hSSk6rkurGuhlcvh+V81qWPQ=; b=KMxSh7B9yWMw8PeMibjvvc2K7UOxI4lmPORR16F3qgfamXgPw6W2rNezAEQwEe6OJiYe4H KA1VFmz3v9+AAAyGKXqh0V2F00BcNrhxAyYwtww9hIJko06aHPQ0Qs+ySI2L/J2EXxUy++ CvEgXKPNZfLsjh7NP0EX4EMRBspJVLGoRpGEZGVn28aSQB2FMNShRbroRGx95X5g5CH1z2 Jmfoo6OzXyLS27oCCIOZJaxYLXmXXqVHJpj66p+awnyn1l9VeiLy2JKTO40uT7ro90AvQj BedSnC4tHLgo1VR7G3ERu+f8FeVmrMFkGCEBOb66xrRWFUbPXEpMUqIwQ2qEcQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600894555; 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=l2WJ9VY/ovlOeTamqA6hSSk6rkurGuhlcvh+V81qWPQ=; b=2urhFSWhq3UaaqI7581rYD0LbsWTkSa2pjmt+peY735+/10gUPHibCgr+piKbh9Xsfbp65 bVJ9t3cFY/BDWVBQ== To: Steven Rostedt , peterz@infradead.org Cc: Linus Torvalds , LKML , linux-arch , Paul McKenney , the arch/x86 maintainers , Sebastian Andrzej Siewior , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Andrew Morton , Linux-MM , Russell King , Linux ARM , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx , dri-devel , Ard Biesheuvel , Herbert Xu , Vineet Gupta , "open list\:SYNOPSYS ARC ARCHITECTURE" , Arnd Bergmann , Guo Ren , linux-csky@vger.kernel.org, Michal Simek , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nick Hu , Greentime Hu , Vincent Chen , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , "David S. Miller" , linux-sparc Subject: Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends In-Reply-To: <20200923115251.7cc63a7e@oasis.local.home> References: <20200919091751.011116649@linutronix.de> <87mu1lc5mp.fsf@nanos.tec.linutronix.de> <87k0wode9a.fsf@nanos.tec.linutronix.de> <87eemwcpnq.fsf@nanos.tec.linutronix.de> <87a6xjd1dw.fsf@nanos.tec.linutronix.de> <87sgbbaq0y.fsf@nanos.tec.linutronix.de> <20200923084032.GU1362448@hirez.programming.kicks-ass.net> <20200923115251.7cc63a7e@oasis.local.home> Date: Wed, 23 Sep 2020 22:55:54 +0200 Message-ID: <874kno9pr9.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23 2020 at 11:52, Steven Rostedt wrote: > On Wed, 23 Sep 2020 10:40:32 +0200 > peterz@infradead.org wrote: > >> However, with migrate_disable() we can have each task preempted in a >> migrate_disable() region, worse we can stack them all on the _same_ CPU >> (super ridiculous odds, sure). And then we end up only able to run one >> task, with the rest of the CPUs picking their nose. > > What if we just made migrate_disable() a local_lock() available for !RT? > > I mean make it a priority inheritance PER CPU lock. > > That is, no two tasks could do a migrate_disable() on the same CPU? If > one task does a migrate_disable() and then gets preempted and the > preempting task does a migrate_disable() on the same CPU, it will block > and wait for the first task to do a migrate_enable(). > > No two tasks on the same CPU could enter the migrate_disable() section > simultaneously, just like no two tasks could enter a preempt_disable() > section. > > In essence, we just allow local_lock() to be used for both RT and !RT. > > Perhaps make migrate_disable() an anonymous local_lock()? > > This should lower the SHC in theory, if you can't have stacked migrate > disables on the same CPU. I'm pretty sure this ends up in locking hell pretty fast and aside of that it's not working for scenarios like: kmap_local(); migrate_disable(); ... copy_from_user() -> #PF -> schedule() which brought us into that discussion in the first place. You would stop any other migrate disable user from running until the page fault is resolved... Thanks, tglx