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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2746CCA485 for ; Thu, 21 Jul 2022 21:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232975AbiGUVC1 (ORCPT ); Thu, 21 Jul 2022 17:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233684AbiGUVCY (ORCPT ); Thu, 21 Jul 2022 17:02:24 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E105904FB; Thu, 21 Jul 2022 14:02:23 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id m17so3672860wrw.7; Thu, 21 Jul 2022 14:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QGH8iGVkQVr4d3CxxIU6taEk8nP/KLAdOHtdDle5izA=; b=Lqi+vYv5emo6R5/SLxe3DMM7ewKKPkhYCzm9oWrm+MdoUNRWLSKmtaFQeBse/n0oAU cZix/lgg6tCQRNaBTutgQQBz6Z++bXLhPYmIDgqkabQxD/bqYPOOXwsncFcRKc0r+tmu 2We0rJz3VRTULAuxZ5f2MywrMjkUP15vJOFsPpKcxynSE34HhWaHpHLqUZzHstda9J9C KA2XdBkL3HM3zITndsmGbuqR4XoxKtrqHC+PPFWyGzvLz2XySZi8VnrKeJ2DA1ZOMn63 G8IfVOV6s3tOTw5zAYZ2h2PQdqWaKwG4WxNl4lCDtn0XD+4O1VKGT/eWJpukCswnACnF SOpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QGH8iGVkQVr4d3CxxIU6taEk8nP/KLAdOHtdDle5izA=; b=bDlDDNobwlI3cgQFe9VLIIhamrSwR3w1Mx/NugXT5coSukbIuuUw7gnm7jEwheeaW4 d28YsK+s9AmwIt8mY9ta0uI7pRU9ioTS6zdR9ocULWYW+Gmd2t++duURJputZKZ3Qd5B lMIkJM+yDuOOBbbM1tdn9XRG5vdbbxn1BbhwNAlg+w6kQiEjPn+UpaGYoFCHoCmlSXgy kEd486JVg9Bx2oN3lN93xl+mBiedZRYIZThUj/acJE8YpuKjwTWHkO3qPQy5vRB2peHR UtvXjdNJTc/TVZloSAk3xygfKoxu/yA0w+1U135krNu3AnUs1PpJyXMbbemZ9DH2f+mj CIAw== X-Gm-Message-State: AJIora8kG6cqLpVysCHaGEhJ04e6gtnFSwwSQanqOzdpnW4cg+qgugAr 0Z6YA0waVYk3T0QSZ2d4ZAs= X-Google-Smtp-Source: AGRyM1uaYG8/IthKEG670yeghS29v1XZ0Cm99Y+vHnPaob7HrGzij/dVBXXy//c6vX6/KwH/ki5uRA== X-Received: by 2002:a5d:5951:0:b0:21e:5abd:8e52 with SMTP id e17-20020a5d5951000000b0021e5abd8e52mr185655wri.528.1658437342770; Thu, 21 Jul 2022 14:02:22 -0700 (PDT) Received: from localhost.localdomain (host-95-235-102-55.retail.telecomitalia.it. [95.235.102.55]) by smtp.gmail.com with ESMTPSA id d12-20020adffbcc000000b0021b8c554196sm2884383wrs.29.2022.07.21.14.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 14:02:21 -0700 (PDT) From: "Fabio M. De Francesco" To: Ira Weiny , Andrew Morton , Catalin Marinas , "Matthew Wilcox (Oracle)" , Will Deacon , Peter Collingbourne , Vlastimil Babka , Sebastian Andrzej Siewior , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: "Fabio M. De Francesco" , Mike Rapoport , Thomas Gleixner Subject: [PATCH 3/7] Documentation/mm: Don't kmap*() pages which can't come from HIGHMEM Date: Thu, 21 Jul 2022 23:02:02 +0200 Message-Id: <20220721210206.13774-4-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220721210206.13774-1-fmdefrancesco@gmail.com> References: <20220721210206.13774-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org There is no need to kmap*() pages which are guaranteed to come from ZONE_NORMAL (or lower). Linux has currently several call sites of kmap{,_atomic,_local_page}() on pages allocated, for instance, with alloc_page(GFP_NOFS) and other similar allocations. Therefore, add a paragraph to highmem.rst, to explain better that a plain page_address() should be used for getting the address of pages which cannot come from ZONE_HIGHMEM. Cc: Andrew Morton Cc: Matthew Wilcox (Oracle) Cc: Mike Rapoport Cc: Sebastian Andrzej Siewior Cc: Thomas Gleixner Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco --- Documentation/vm/highmem.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/vm/highmem.rst b/Documentation/vm/highmem.rst index c9887f241c6c..f266354c82ab 100644 --- a/Documentation/vm/highmem.rst +++ b/Documentation/vm/highmem.rst @@ -71,6 +71,12 @@ list shows them in order of preference of use. kmap_local_page() always returns a valid virtual address and it is assumed that kunmap_local() will never fail. + On CONFIG_HIGHMEM=n kernels and for low memory pages this returns the + virtual address of the direct mapping. Only real highmem pages are + temporarily mapped. Therefore, users should instead call a plain + page_address() for getting the address of memory pages which, depending + on the GFP_* flags, cannot come from ZONE_HIGHMEM. + Nesting kmap_local_page() and kmap_atomic() mappings is allowed to a certain extent (up to KMAP_TYPE_NR) but their invocations have to be strictly ordered because the map implementation is stack based. See kmap_local_page() kdocs -- 2.37.1