Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp281684pxk; Thu, 24 Sep 2020 05:45:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx10QeEw4PIxfSc9NFVHpgOHC4z3BCt+mdenTn4Te5X5A3NeomqyZ0sXRaOpKEzAhEJUMth X-Received: by 2002:aa7:ca46:: with SMTP id j6mr810865edt.155.1600951507455; Thu, 24 Sep 2020 05:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600951507; cv=none; d=google.com; s=arc-20160816; b=Eyd3NyFfmYWZe0qT0O5e6TOZEoRU4zcKf+HcYYoCeWmdLxhSP6pbqPnlOxWWlVuoHM Ke1Bs5GL+/ptWNWA3aXaHKed6BfiSopuc6+6NYcoojTFRZ6sWI54pvmT3TkCn9Twe1qP DYw77R2C+fu3AiqmbbHZwQPEZcYAMF54Itwqyz+wembY4oyuYOIw1iXN7iI0U3HflHMm RMdPPHsgQ5PaD3M9JxZzEBk/uKCl45xpptNWqo8zW076Reky0CTj/DueR+fU5kvoToPq 78dtJWHBsCXngsH2QmikpbRvn6syYxeGAcbVSPpnFrjYXTymSzi1JcohmLoUOUnwQRnX pBhg== 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=SdhPXkSs5ZPBi948PCp3uVHmQU1pxaOPhPPF1KHSOtI=; b=ecFd3WR00CfH4Z0Ckzm9mSMajBXoWMCi06dxHJkFdRkX5u1S5YXRumIxYg0MzzNDk1 GhjtwVbToQSfT4xntTg2kxye6hORvHqbBuEZIbwxbRQ2vhghZwyBbOqQCiXsGGT6kAXF Q3dNyTb8D2nLmvWIvyIocQic4J3Pr3qss/mcoST+utPrXqLcvHpXdZcNsP+ye1kgu9yy V978DPctVT0QDlB9vMMzRk0hVLLkRYm0+NLvjCjM0oNUIUgWEL5oJDkr03vUcJHNeKcE WW7ph+uYLrXPdoAE32AeskDAeTXZtc78hkFUF4X2gtdvqRdPiaWGexrC+78BBVjX2ZjJ leJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=cfpXNMYz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si2109015edr.508.2020.09.24.05.44.43; Thu, 24 Sep 2020 05:45:07 -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=@infradead.org header.s=merlin.20170209 header.b=cfpXNMYz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbgIXMnu (ORCPT + 99 others); Thu, 24 Sep 2020 08:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727738AbgIXMnu (ORCPT ); Thu, 24 Sep 2020 08:43:50 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A01C0613CE; Thu, 24 Sep 2020 05:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=SdhPXkSs5ZPBi948PCp3uVHmQU1pxaOPhPPF1KHSOtI=; b=cfpXNMYzVRlId2AJBOa+GyLPt6 zTFRf6xk7foaFg4tpi+0P2wk3EKKrMLVo5gmNxHWe7qOcz3Hmx3VWmRHmwVx/FwsBrIZ4LPXgFqji cbVT02P2X6YSp/qAxsPzP7xWma/nd4gLtLGrrxZddBcakdrjDZddjCYlGyyVHu59U4aaO6z8FZ60s 49IhfEr0KMLRog0k4Y5qS0akYgifDqnz2qj8WKdCAn3F5dxbkr8x0mpQnMaztMPQpwH5mtFjW59VG NHALCniQ15G9RJsPp0Y7Yvd0LIio3hjjsinuCY0H4Jgz5zGhVlW6aMgLPr7GKSkFGiFv6cxeg9duh Tyn/G/Dw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLQaG-0005M9-J5; Thu, 24 Sep 2020 12:42:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C0F753007CD; Thu, 24 Sep 2020 14:42:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A98B620297EC5; Thu, 24 Sep 2020 14:42:41 +0200 (CEST) Date: Thu, 24 Sep 2020 14:42:41 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: Thomas Gleixner , 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 Message-ID: <20200924124241.GK2628@hirez.programming.kicks-ass.net> References: <87a6xjd1dw.fsf@nanos.tec.linutronix.de> <87sgbbaq0y.fsf@nanos.tec.linutronix.de> <20200923084032.GU1362448@hirez.programming.kicks-ass.net> <20200923115251.7cc63a7e@oasis.local.home> <874kno9pr9.fsf@nanos.tec.linutronix.de> <20200923171234.0001402d@oasis.local.home> <871riracgf.fsf@nanos.tec.linutronix.de> <20200924083241.314f2102@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924083241.314f2102@gandalf.local.home> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 08:32:41AM -0400, Steven Rostedt wrote: > Anyway, instead of blocking. What about having a counter of number of > migrate disabled tasks per cpu, and when taking a migrate_disable(), and there's > already another task with migrate_disabled() set, and the current task has > an affinity greater than 1, it tries to migrate to another CPU? That doesn't solve the problem. On wakeup we should already prefer an idle CPU over one running a (RT) task, but you can always wake more tasks than there's CPUs around and you'll _have_ to stack at some point. The trick is how to unstack them correctly. We need to detect when a migrate_disable() task _should_ start running again, and migrate away whoever is in the way at that point. It turns out, that getting selected for pull-balance is exactly that condition, and clearly a migrate_disable() task cannot be pulled, but we can use that signal to try and pull away the running task that's in the way.