From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FAA7C2D0A3 for ; Tue, 3 Nov 2020 17:48:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C15821D91 for ; Tue, 3 Nov 2020 17:48:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="HlBdVjW4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C15821D91 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC1766B0036; Tue, 3 Nov 2020 12:48:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E70A36B005C; Tue, 3 Nov 2020 12:48:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D38F76B005D; Tue, 3 Nov 2020 12:48:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id A49DD6B0036 for ; Tue, 3 Nov 2020 12:48:30 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4193F180AD801 for ; Tue, 3 Nov 2020 17:48:30 +0000 (UTC) X-FDA: 77443841580.17.low17_0b0d0b9272ba Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 12EC3180D0185 for ; Tue, 3 Nov 2020 17:48:30 +0000 (UTC) X-HE-Tag: low17_0b0d0b9272ba X-Filterd-Recvd-Size: 7114 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 17:48:29 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id m8so13955145ljj.0 for ; Tue, 03 Nov 2020 09:48:29 -0800 (PST) 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=o0HUqTtrB0uneYNpLQNhQJ6FusME7LjWI9KZLqRyy8M=; b=HlBdVjW42hUSJkakIiVHCgxY07l6tlPx/MKTOg49MQqEt9fKpSl2tO6bNlSfEMf3/D yOb2ZUXxHpDZzPlQCZuCKgGgj4iIodCB3C8y4WCLAE53N4IY/fO4MumxqPXGllxVBzjJ AuMTxQdvsElAjMkZERbVlQwjny9JwixE30+4I= 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=o0HUqTtrB0uneYNpLQNhQJ6FusME7LjWI9KZLqRyy8M=; b=tsiHKqtTbZmR1ePdT+KQU7qMiS30w94PhSYI+HteqPeiJf/SKuFHkTvXl6i3to82Zh 23ZRh5rrHq6lvJXC+mvfaYkXKYsr/1TfX/EonJPUt1Jz1iITgp3nH9UMzrvcVkEvhrpv A+nNy0FhhdVD0wOhFXQeRRJr3rI3tgi3BFzVdpifw69enoZvWAlnZB56RKYFVCL9Qbyj GbaN6jrtGEMYBX0mmGEHyk/iduxa88+wxn+ac6JISOk3KAWT4ytSMZRyHnxpDM0SKs32 PI72GNDuGbiHA5fuGjXgBOsCC+Nl0FfYnjM06ffzZx4hLaLzfF3JuTwkd4if36rcdf+q kZDw== X-Gm-Message-State: AOAM531aHtm2WwSYWiAzgdRTaMbiabuGPtqGmsxqpzFNouzsBg4gTANe /HerWhBEBCjGJG/cQF3FhvpOsmlrGCqfzg== X-Google-Smtp-Source: ABdhPJxvDAzkG1UJOdsw+pFVDtLm07rpxatMKA9OBc360S7JMUqNlDkauVxOeMJfsPgFhsSdNydI2g== X-Received: by 2002:a2e:88c9:: with SMTP id a9mr8730712ljk.193.1604425708027; Tue, 03 Nov 2020 09:48:28 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id s1sm4048212lfd.236.2020.11.03.09.48.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 09:48:27 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id 126so23343915lfi.8 for ; Tue, 03 Nov 2020 09:48:27 -0800 (PST) X-Received: by 2002:a19:4815:: with SMTP id v21mr8859386lfa.603.1604425706752; Tue, 03 Nov 2020 09:48:26 -0800 (PST) MIME-Version: 1.0 References: <20201103092712.714480842@linutronix.de> <20201103095858.827582066@linutronix.de> In-Reply-To: <20201103095858.827582066@linutronix.de> From: Linus Torvalds Date: Tue, 3 Nov 2020 09:48:10 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch V3 22/37] highmem: High implementation details and document API To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Paul McKenney , Christoph Hellwig , Sebastian Andrzej Siewior , Andrew Morton , Linux-MM , Alexander Viro , Benjamin LaHaise , linux-fsdevel , linux-aio@kvack.org, Chris Mason , Josef Bacik , David Sterba , linux-btrfs , "the arch/x86 maintainers" , Vineet Gupta , "open list:SYNOPSYS ARC ARCHITECTURE" , Russell King , Arnd Bergmann , Linux ARM , 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 , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Christian Koenig , Huang Rui , David Airlie , Daniel Vetter , dri-devel , VMware Graphics , Roland Scheidegger , Dave Airlie , Gerd Hoffmann , virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, Ben Skeggs , nouveau@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , intel-gfx Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 3, 2020 at 2:33 AM Thomas Gleixner wrote: > > +static inline void *kmap(struct page *page) > +{ > + void *addr; > + > + might_sleep(); > + if (!PageHighMem(page)) > + addr = page_address(page); > + else > + addr = kmap_high(page); > + kmap_flush_tlb((unsigned long)addr); > + return addr; > +} > + > +static inline void kunmap(struct page *page) > +{ > + might_sleep(); > + if (!PageHighMem(page)) > + return; > + kunmap_high(page); > +} I have no complaints about the patch, but it strikes me that if people want to actually have much better debug coverage, this is where it should be (I like the "every other address" thing too, don't get me wrong). In particular, instead of these PageHighMem(page) tests, I think something like this would be better: #ifdef CONFIG_DEBUG_HIGHMEM #define page_use_kmap(page) ((page),1) #else #define page_use_kmap(page) PageHighMem(page) #endif adn then replace those "if (!PageHighMem(page))" tests with "if (!page_use_kmap())" instead. IOW, in debug mode, it would _always_ remap the page, whether it's highmem or not. That would really stress the highmem code and find any fragilities. No? Anyway, this is all sepatrate from the series, which still looks fine to me. Just a reaction to seeing the patch, and Thomas' earlier mention that the highmem debugging doesn't actually do much. Linus