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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 087B1C2D0A3 for ; Tue, 3 Nov 2020 17:55:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A649B2236F for ; Tue, 3 Nov 2020 17:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604426103; bh=8fVJWgla4KvY923+S8nJo2bwOt/u6tN/h35pUSLm1e4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=rD4k+w7eD3ePwqWxFqIcJktcaQTv6gdMvjs2KJzHBY4CfiRi+x/7LSeG84ioZuxB6 TAg49pdhMFYBqicz6c2nApIlDsB/UgHb0H6FYILOg5GEz6yDIv32BssnqtaQDSZMh7 yzjuOYcd5rLBuaUWXqTOMh8YKIPrTNna7QoXJNWk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728206AbgKCRzC (ORCPT ); Tue, 3 Nov 2020 12:55:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727688AbgKCRzC (ORCPT ); Tue, 3 Nov 2020 12:55:02 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF94C0613D1 for ; Tue, 3 Nov 2020 09:55:01 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id o21so18433023ejb.3 for ; Tue, 03 Nov 2020 09:55:01 -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=jA5jJFLEW6uR7xPA0/m5r6s1gKY/TCcSHWdYBVJ2PTEL47w8KB9tycaKQh1Uup5nG2 HM8YkBWrZlW775aQINmKVzs8R63TfDNl87ld7GwG/+06VGbxkXDX6FAjH7ho5CApVaGm u8k1yqGzunkxgeYtDdJpjTvckbGAuxyMcGwT4mglvJLa63uSQrrvSdFaA9B6T24p66Eo 4q2qLqIsqeNvM+aiWy0Ddtcc8E9GIbDjYH6NGHB9J3Ymd9TR6ycESxxfQKITnM28F7V9 /9r8tCYqo8oT7xxgOXlPGm1/k2SQDBd+PyfTERYeswgwwSmeMZGw0GGmvhlps0xpSjw9 W7/w== X-Gm-Message-State: AOAM533zy8mdcutdSjeeAz+VMnZ+oNbfYHRbMyhdAMvHC1fpJVr2V9Rw 1Ju9I0RzHefHxVXVW2nXy9OAeFvIiNAX/A== X-Google-Smtp-Source: ABdhPJwShwgoicHkChF6PmgVtr/yChh/D9APjdfTElrt+KJamVoLBZwXJpcNeJyqLJ7Qp8lpINfZvw== X-Received: by 2002:a17:906:9702:: with SMTP id k2mr21142231ejx.494.1604426100172; Tue, 03 Nov 2020 09:55:00 -0800 (PST) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com. [209.85.218.50]) by smtp.gmail.com with ESMTPSA id j6sm8197871edy.87.2020.11.03.09.54.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 09:55:00 -0800 (PST) Received: by mail-ej1-f50.google.com with SMTP id dk16so24884327ejb.12 for ; Tue, 03 Nov 2020 09:54:59 -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" Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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