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=-5.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 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 5AB3FC433E0 for ; Mon, 1 Mar 2021 19:43:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B67D46024A for ; Mon, 1 Mar 2021 19:43:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B67D46024A 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 EBB5F8D009A; Mon, 1 Mar 2021 14:43:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E44228D0063; Mon, 1 Mar 2021 14:43:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBEF88D009A; Mon, 1 Mar 2021 14:43:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id AEC998D0063 for ; Mon, 1 Mar 2021 14:43:16 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6BB048249980 for ; Mon, 1 Mar 2021 19:43:16 +0000 (UTC) X-FDA: 77872329192.26.E0B6CC7 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf20.hostedemail.com (Postfix) with ESMTP id 2ADAF351D for ; Mon, 1 Mar 2021 19:43:05 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id e2so13748144ljo.7 for ; Mon, 01 Mar 2021 11:43:05 -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=Bl+ZuzEypuf8kg9PH2Q+NcKdz61SR9M1N9NpVnL3IcY=; b=f8FI/aqMcBBwEswSOdmXhLFX2VmTftmQin4Rehq7YmdpV9rTs2SDqzaK8M7LvMOD55 vr6M95MznwWygUjeVeAXYL9pdYzu8EJ4nqzFAQBEy+Q47DlFyUCXsskZ0r9gqBJthmEW y/Bm4+KZFyW5bHsHSAcIXpCSy+dyNpwWlhRUc= 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=Bl+ZuzEypuf8kg9PH2Q+NcKdz61SR9M1N9NpVnL3IcY=; b=Wh6T70vYRQAKNzn9o7SQwf3TDalPJa1XHirfPyrPEKUzbo4XHQJ2n/6ltu1X3mNoqm w26piRK7Lyz5Y0+nIG9HDRfMm8nFA45gee7V2lOToO2ejjo08j7bOM7LNjDfKivs6YRw lhZys8w6o+WZX8EDW9sDu7MBoaiIP3t8j2//NyQp2Wl+TmEx0CwPSGXxTAplA70H+s9V Jr0q8xZTa3ThfN8/6Fx0r2Xoi7YLbBWJEbBgrDv8wN3Mdhw89qvWseimTR8QLfqJeT+0 JzK5BtOpG5pA0FQ4PZ1Tu9UavR3VAg6QkfEZKkeejX/Fbi9Yt9XNokaqo8Ois2sJDrVY GFqg== X-Gm-Message-State: AOAM531BQ3ek8uQKYzqi1T+axVGz+vZ1I7i0Le7PoSZrGJQ4+JhHXz1W DYdMdWSxAmr2LhfUF0/fqhhRYEi6LuA8xA== X-Google-Smtp-Source: ABdhPJyr3p5aKT2848Sud64y77OOw510jJ6V79i1+wiUI3x23OyxzQz5T1KBJVcBwz8jiiPSNbkSOA== X-Received: by 2002:a2e:5c02:: with SMTP id q2mr9971950ljb.81.1614627778909; Mon, 01 Mar 2021 11:42:58 -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 y8sm179031ljk.9.2021.03.01.11.42.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Mar 2021 11:42:58 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id d3so27393004lfg.10 for ; Mon, 01 Mar 2021 11:42:57 -0800 (PST) X-Received: by 2002:a05:6512:398d:: with SMTP id j13mr10013711lfu.41.1614627777255; Mon, 01 Mar 2021 11:42:57 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 1 Mar 2021 11:42:41 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Kmap conversions for 5.12, take 2 To: David Sterba Cc: Linux Kernel Mailing List , Ira Weiny , Linux-MM Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: zicpa3nwyrnx34w66f7xszjniqbiadga X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2ADAF351D Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail-lj1-f180.google.com; client-ip=209.85.208.180 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614627785-678475 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 Mon, Mar 1, 2021 at 8:52 AM David Sterba wrote: > > Ira Weiny (6): > mm/highmem: Lift memcpy_[to|from]_page to core > mm/highmem: Convert memcpy_[to|from]_page() to kmap_local_page() > mm/highmem: Introduce memcpy_page(), memmove_page(), and memset_page() > mm/highmem: Add VM_BUG_ON() to mem*_page() calls > btrfs: use memcpy_[to|from]_page() and kmap_local_page() > btrfs: use copy_highpage() instead of 2 kmaps() So I've pulled this now, although I still end up wondering about one case there: - char *map; - - map = kmap(page); - memcpy(map, data_start, datal); + memcpy_to_page(page, 0, data_start, datal); flush_dcache_page(page); - kunmap(page); where that flush_dcache_page() is now done outside the kmap of the page. If you have an architecture that does both (a) highmem and (b) virtual caches, it means that the "memcpy_to_page()" gets done using one virtual address, and the flush_dcache_page() could in theory be done using another virtual address. I do not believe this is a problem in practice (flush_dcache_page() might have to kmap it again, but presumably get the same virtual address, although who the heck knows). And I personally don't know that we should even care any more - I've been arguing that we should start deprecating highmem entirely, and while there are 32-bit arm chips that still use them, I hope to $DEITY that those ARM chips aren't the garbage virtual cached ones. Furthermore, I think that kunmap() always guaranteed that the cache was flushed anyway before unmapping, because anything else would have been too broken for words anyway. So I think _all_ of those flush_dcache_page() cases were just largely bogus. I can't be bothered to really look into it, because at some point, crap hardware is just too crap to even care about. Pure virtual caches are where I personally say "I don't care". But I'm mentioning it because there might be some masochistic person out there that finds this issue interesting, and wants to do some self-flagellation to dive into this all and make sure it's ok. Linus