Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1123694pxb; Fri, 20 Nov 2020 01:32:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0PSFjWLQIhka4TyMX69So/uiWKgsSCHH+Fo2QZ5/Gly1vQWoVwizr8Iyre58TD4EeXd7w X-Received: by 2002:a17:906:3641:: with SMTP id r1mr30799858ejb.405.1605864735534; Fri, 20 Nov 2020 01:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605864735; cv=none; d=google.com; s=arc-20160816; b=BZfaK9elJtRJBHlfon/o8+bb0Sf7qTCFF1lCuVRJmGcDAhXBEeKcEoPHH1VXtrCc1a JhaMAVEL8P06RTh7LOIp6GmOaqhKzix3kNwSpcmEf4UqDPW5wGuhIPcr+rxGZqcILlqm z9mrPIMRr6ZJf5cKeQc9nFq8iEsGrm5SFajIC/NyoR9WjnaKSpY/mwBWStOdD8MH2Io8 zlBfQDg+JkG1CtKMsOgEaKYdyN5vg0XpTa43YB5xNN1jJdTeylZYoVa4KOncVNpJrMvF Vkj+iy4MCdR7CVv2EUmgoVbjgEUfImx2FgaI0IOKnoJnmRWwSJyKNRjk3FkFniAK34HM gKwg== 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=KnWHAuO/d7na5b0cDyX5jOiWukZojb1N5brkXlfYaXQ=; b=WaKeLLdvd+mN6Je1mT0WH9dgS4Iqd9O2CXIjEu+DXfjyP5W3eo5XyBX6dQLJNFm5z0 4etf2w98EYLafOrmlw770dx3Ul1lhX1gkT8vxYXDGPgHPfvQQWah6vo0nJ+dUZeee9bk u5znG3bdu+6PFZfzBgxHCYMEPgCc2jkpptV3oH2Tur4CGNGqlnTqtGEkkon5BWj/oBD8 L3HNgbTqHFhxT7+DPpCf3GPo6lpgGH7wzJnd+nIbVTgC6f1DC5BSCYVEN/WLsWuSu+r3 88WK3MNoXlpGjGl/xYO+fhORctAUYvI70nyRUNJ8axEDPjEHEDc0uNhPbEL+gQPclzxK /T5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=dE4QPEP4; 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 lw7si1436099ejb.149.2020.11.20.01.31.53; Fri, 20 Nov 2020 01:32:15 -0800 (PST) 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=casper.20170209 header.b=dE4QPEP4; 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 S1727145AbgKTJ3u (ORCPT + 99 others); Fri, 20 Nov 2020 04:29:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727120AbgKTJ3t (ORCPT ); Fri, 20 Nov 2020 04:29:49 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A5AC0613CF for ; Fri, 20 Nov 2020 01:29:49 -0800 (PST) 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=KnWHAuO/d7na5b0cDyX5jOiWukZojb1N5brkXlfYaXQ=; b=dE4QPEP4pDETcw4r21v+Q06SMs c4Mz7MNxnXchPKYlFMI2qc/c+vUJko74+sQ/IM9aLhYk8dYcJEkEtvOn3Xynv32v6WnwbBmCAPPvi d+cZiHWBAfX6APUu1ZUA5o1HeqV6iWTF7sBBuMloWPFHXfvlx/SCUn+Ts7AVQ9ODdJJzA8jfsZ5+k MmXp6MVKgdU3YPOfGdn/Gu/Nc0LKVK3W/TMJPjWeeL8tAD3gK5/AMQeCDb1SVocqi+BBsG+Bp3mGt sNTX08D8rCRefJRSfrTwtI7l0AcsOIH2SqwlICfkoK1+bRXsNGrUFVxBRc3yhIE8FLnw643WDHxJU H6ttX5Dw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kg2jR-00056M-Kw; Fri, 20 Nov 2020 09:29:30 +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 96425304D28; Fri, 20 Nov 2020 10:29:28 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 72147200E6202; Fri, 20 Nov 2020 10:29:28 +0100 (CET) Date: Fri, 20 Nov 2020 10:29:28 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: Linus Torvalds , Mel Gorman , LKML , the arch/x86 maintainers , Christoph Hellwig , Matthew Wilcox , Daniel Vetter , Andrew Morton , Linux-MM , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira Subject: Re: [patch V4 4/8] sched: Make migrate_disable/enable() independent of RT Message-ID: <20201120092928.GA3021@hirez.programming.kicks-ass.net> References: <20201118194838.753436396@linutronix.de> <20201118204007.269943012@linutronix.de> <20201119093834.GH3306@suse.de> <20201119111411.GL3121378@hirez.programming.kicks-ass.net> <20201119182843.GA2414@hirez.programming.kicks-ass.net> <87tutkolq1.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tutkolq1.fsf@nanos.tec.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 02:33:58AM +0100, Thomas Gleixner wrote: > On Thu, Nov 19 2020 at 19:28, Peter Zijlstra wrote: > > On Thu, Nov 19, 2020 at 09:23:47AM -0800, Linus Torvalds wrote: > >> Because this is certainly not the only time migration limiting has > >> come up, and no, it has absolutely nothing to do with per-cpu page > >> tables being completely unacceptable. > > > > It is for this instance; but sure, it's come up before in other > > contexts. > > Indeed. And one of the really bad outcomes of this is that people are > forced to use preempt_disable() to prevent migration which entails a > slew of consequences: > > - Using spinlocks where it wouldn't be needed otherwise > - Spinwaiting instead of sleeping > - The whole crazyness of doing copy_to/from_user_in_atomic() along > with the necessary out of line error handling. > - .... > > The introduction of per-cpu storage happened almost 20 years ago (2002) > and still the only answer we have is preempt_disable(). IIRC the first time this migrate_disable() stuff came up was when Chris Lameter did SLUB. Eventually he settled for that cmpxchg_double() approach (which is somewhat similar to userspace rseq) which is vastly superiour and wouldn't have happened had we provided migrate_disable(). As already stated, per-cpu page-tables would allow for a much saner kmap approach, but alas, x86 really can't sanely do that (the archs that have separate kernel and user page-tables could do this, and how we cursed x86 didn't have that when meltdown happened). [ and using fixmaps in the per-cpu memory space _could_ work, but is a giant pain because then all accesses need GS prefix and blah... ] And I'm sure there's creative ways for other problems too, but yes, it's hard. Anyway, clearly I'm the only one that cares, so I'll just crawl back under my rock...