Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp947870imi; Thu, 21 Jul 2022 14:08:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sMBgf7D8f8tIUw9Gp+rLHu8V/shdnIt2Ww67fkhNZIE/UWhafuy2jpSYO7OmvQD2jY3eX+ X-Received: by 2002:a17:907:9706:b0:72b:4b0d:86a2 with SMTP id jg6-20020a170907970600b0072b4b0d86a2mr402494ejc.242.1658437728005; Thu, 21 Jul 2022 14:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658437727; cv=none; d=google.com; s=arc-20160816; b=obrrZKjh7tVq36gEO44dQODSxc1PMBULqDnjhAHmzOdbIHzZHMd6Y+ysWCfznI8rLV wuiqo6osi8hkNPoghVYCnMOMPZ8D5ukS2W5qHp5COwCNVpN6dxfB45Lj7770UMhCsQ/F muBvQveu3BcgBkZ9b0XjFGkMeL6fOPRwWPVZFMm5znD3ps0iOs8vY21yRWkxR6L9wMBm mEaz4fpGBdM2KkfWaxI1P7Yzg7IkPZuc0HO95E33I09R8laYQkDVyX0Xf9Gqpjy0LLbN cnZWzJ7+LR/hY+k/Af6hpPQQrEJuk5nM33n6YPSGKMrk4QV+R4Dgct/xprL7ImhYYrkR 4s7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QGH8iGVkQVr4d3CxxIU6taEk8nP/KLAdOHtdDle5izA=; b=tD+bq1ByA+dz9DOs5qFR9L4aBBlFoeozbqKCJPP/JfCJT3o6FD3da5z8Ms65haidnB PiTIT3xvX2PwVt3A+7NPJbe3b8Zu3Xo1banOb/yMhLPG+3OPfPd4PHJ80b1ddEaq4MbJ yfidRuIKGNGxs4kIjPt5dhbdx0QIwVgKP9D3tGb8rvCPlpcZ3VXGyMmWmdZSw4jfj83V FkNsX28+LP2WQVBnU+bG0U8VztnpGLOcLug3Sq5vED99pAgz7K+oaG3Ng0kdAP8x/XdG snrsdhYG3GBuCTz55TKQtMI21DbsJcL0SiSnX/kR5D5RhY09JmHnAIzFpLlaPq5qJbqs NOcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lqi+vYv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f28-20020a056402329c00b0043bcb538bc3si1089849eda.570.2022.07.21.14.08.23; Thu, 21 Jul 2022 14:08:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lqi+vYv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233652AbiGUVCa (ORCPT + 99 others); Thu, 21 Jul 2022 17:02:30 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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