Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2036978pxk; Sat, 19 Sep 2020 10:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcSfB0UDG1UARES6HsjMUeqEbUdAmHazaPAwnMqMiD21DflFQp2paOM898hhVozUn4NNnL X-Received: by 2002:a05:6402:3c8:: with SMTP id t8mr43289178edw.266.1600536125234; Sat, 19 Sep 2020 10:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600536125; cv=none; d=google.com; s=arc-20160816; b=HLfA87eQ3tyTHTT/VjDOyeKwBheQ7gJP3VsWClx+yNe5XANRczBgFvqMPof9z0yy77 UScjuHq+jPNc2cBvu+Ny5x4NVsUsV+Qv/ywnW3vgW5l4q6NdfzaHQNcKBEN1GyrrUG5n R0tO+9qQlnKAL6I9SskEYVZZZRGnFKSzCFFcwnr+chgqGwvoRjoGJFOFdvAmKPaPa9a8 MfLL8++gaz33K65+X7Gw1uWDr8nQyWUPI1jzLa++EAfrwB4wxqiKlEBZtasq/nPPFg+n 4LCMTgy5X0a+3eLTSvzgFRgEZilCcIFp7gOc70/ErJN1CcvzQ1yqaXRnxxyHOShGYI2T dWcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=waM6UyKAxKjxaPuk1aOj7tJ5Pe/ksOuiXEzSSo1PI/U=; b=Q3fd7nwvxMujJtqLpaaTMNvxU9yMoGfHck5jB20V3+uMFQiM92lunZM38UMZNX7wO2 YATZsa730x9P3KzBd7Equ2q+krSSNB0H1bzOQALzU/0TT1/Y8hbN/t2aZaMYYsN93m2h Ud0Fu2j1tmdLNn5Vy+BmTGJox1qKom0TFpEEtdSxPXwU9HZVcqe/SDABanXReb6eUq1l JaNH4o9p/F/lkf64IVXGfMRxF7vyFGPf+FvqP+BYJqvIohVl7pmx0HNC2K8PeWRdgmcw wvR7Y/Ky8n8AzCVcdbTEpnAXfL2sLXgcex7+Vl8GrSzf780sx4vrYguL2iiSWk2ekTee qUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PDwKTi4l; 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 z18si4764404ejr.232.2020.09.19.10.21.25; Sat, 19 Sep 2020 10:22:05 -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=@linux-foundation.org header.s=google header.b=PDwKTi4l; 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 S1726549AbgISRTQ (ORCPT + 99 others); Sat, 19 Sep 2020 13:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbgISRTQ (ORCPT ); Sat, 19 Sep 2020 13:19:16 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19271C0613CE for ; Sat, 19 Sep 2020 10:19:16 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id w11so9589340lfn.2 for ; Sat, 19 Sep 2020 10:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=waM6UyKAxKjxaPuk1aOj7tJ5Pe/ksOuiXEzSSo1PI/U=; b=PDwKTi4lX9j7zg3G7WzPyBOHBiLdhmAgWRxWPWvYR/nEys9FVfUL6zNUVgG09pDixg o+e2DCxbAvOZN3jBhyrOMZPfygh9RU8mogp2HXrCoLkUWHRL8e1VK4NRvgzXaMsluBfo GR1BPuNqLZOfJqo2g/IqA9gl4eqzfpV+zOYak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=waM6UyKAxKjxaPuk1aOj7tJ5Pe/ksOuiXEzSSo1PI/U=; b=m+xnfXXeN0BCgwSvgDPodbKc3duUacutfnoknKFK1b1lx7p3Jr1f7fZupHcmLTu7gg lzD0YLBC7lK45WcCkF4RjQqC1XUDJssc08nCr+kr9N0z8BjSeLurE8dU5yqptslnw+6X F36nGCNbcL6/N7Rin8qrh8tk2WTQo6IqSkwwdJ4GznBm3cEfJ2X6MbzDcfHI4m8hQPuM P7S6ZkfHU4CJQXlzEv7xS/NqLrvzGlF6XGGr91scgeCIs7OIfIEpw8O3yVYY6Lo8WcZq k6yBKawpHFgQg+0a7rdnzvLDFEZtiabXj1awyd6zfSJI9Vw7w00IT+VLAVCSEmSSmAl/ sNAQ== X-Gm-Message-State: AOAM5303xrNEpI7eSbAF6EehCtDq5f0wQdvHLNk4aWWnBk+o+ZQFO1kF HySIbh5B0YqVgD9UYFGnUdWALNtSprIvZA== X-Received: by 2002:a05:6512:52a:: with SMTP id o10mr11877369lfc.596.1600535953619; Sat, 19 Sep 2020 10:19:13 -0700 (PDT) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id 13sm1350521lfn.239.2020.09.19.10.19.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Sep 2020 10:19:12 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id b22so9520092lfs.13 for ; Sat, 19 Sep 2020 10:19:11 -0700 (PDT) X-Received: by 2002:a19:521a:: with SMTP id m26mr14134256lfb.133.1600535951025; Sat, 19 Sep 2020 10:19:11 -0700 (PDT) MIME-Version: 1.0 References: <20200919091751.011116649@linutronix.de> In-Reply-To: <20200919091751.011116649@linutronix.de> From: Linus Torvalds Date: Sat, 19 Sep 2020 10:18:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends To: Thomas Gleixner Cc: LKML , linux-arch , Paul McKenney , "the arch/x86 maintainers" , Sebastian Andrzej Siewior , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 2:50 AM Thomas Gleixner wrote: > > this provides a preemptible variant of kmap_atomic & related > interfaces. This is achieved by: Ack. This looks really nice, even apart from the new capability. The only thing I really reacted to is that the name doesn't make sense to me: "kmap_temporary()" seems a bit odd. Particularly for an interface that really is basically meant as a better replacement of "kmap_atomic()" (but is perhaps also a better replacement for "kmap()"). I think I understand how the name came about: I think the "temporary" is there as a distinction from the "longterm" regular kmap(). So I think it makes some sense from an internal implementation angle, but I don't think it makes a lot of sense from an interface name. I don't know what might be a better name, but if we want to emphasize that it's thread-private and a one-off, maybe "local" would be a better naming, and make it distinct from the "global" nature of the old kmap() interface? However, another solution might be to just use this new preemptible "local" kmap(), and remove the old global one entirely. Yes, the old global one caches the page table mapping and that sounds really efficient and nice. But it's actually horribly horribly bad, because it means that we need to use locking for them. Your new "temporary" implementation seems to be fundamentally better locking-wise, and only need preemption disabling as locking (and is equally fast for the non-highmem case). So I wonder if the single-page TLB flush isn't a better model, and whether it wouldn't be a lot simpler to just get rid of the old complex kmap() entirely, and replace it with this? I agree we can't replace the kmap_atomic() version, because maybe people depend on the preemption disabling it also implied. But what about replacing the non-atomic kmap()? Maybe I've missed something. Is it because the new interface still does "pagefault_disable()" perhaps? But does it even need the pagefault_disable() at all? Yes, the *atomic* one obviously needed it. But why does this new one need to disable page faults? [ I'm just reading the patches, I didn't try to apply them and look at the end result, so I might have missed something ] The only other worry I would have is just test coverage of this change. I suspect very few developers use HIGHMEM. And I know the various test robots don't tend to test 32-bit either. But apart from that question about naming (and perhaps replacing kmap() entirely), I very much like it. Linus