From patchwork Tue Mar 22 21:47:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789270 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4E68C433F5 for ; Tue, 22 Mar 2022 21:48:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 536296B0198; Tue, 22 Mar 2022 17:48:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BDA56B0199; Tue, 22 Mar 2022 17:48:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D6A66B019A; Tue, 22 Mar 2022 17:48:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 21E116B0198 for ; Tue, 22 Mar 2022 17:48:01 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D786B8249980 for ; Tue, 22 Mar 2022 21:48:00 +0000 (UTC) X-FDA: 79273360320.24.AF3E7C8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id 3DA07180043 for ; Tue, 22 Mar 2022 21:48:00 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6937615BD; Tue, 22 Mar 2022 21:47:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A924C340EC; Tue, 22 Mar 2022 21:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985679; bh=qpcuFDUcYAmFeBf1F6hEHT80Ur3W5fKvcCX8Qm302zM=; h=Date:To:From:In-Reply-To:Subject:From; b=BUbJS6yP06zf9YHUEVoPSFkEQLtGdmC8ahyLEzvis2338Im/SN59G+vm1x+kx4/9a Sw4XXHyIHJXNAZgFtvyYb9QzSW1Dt5tepVWyHWx7wSPW2cLyj0Qh3x0uiPkI5M6Njz 1GfcwJjmlZKET5gXj/U36CVftmUtHp8rkBDmW31g= Date: Tue, 22 Mar 2022 14:47:58 -0700 To: ira.weiny@intel.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 186/227] highmem: document kunmap_local() Message-Id: <20220322214759.0A924C340EC@smtp.kernel.org> X-Stat-Signature: nnwffspdkgitfkk9jyswc8kojdjo4uwb Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=BUbJS6yP; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3DA07180043 X-HE-Tag: 1647985680-269663 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: From: Ira Weiny Subject: highmem: document kunmap_local() Some users of kmap() add an offset to the kmap() address to be used during the mapping. When converting to kmap_local_page() the base address does not need to be stored because any address within the page can be used in kunmap_local(). However, this was not clear from the documentation and cause some questions.[1] Document that any address in the page can be used in kunmap_local() to clarify this for future users. [1] https://lore.kernel.org/lkml/20211213154543.GM3538886@iweiny-DESK2.sc.intel.com/ [ira.weiny@intel.com: updates per Christoph] Link: https://lkml.kernel.org/r/20220124182138.816693-1-ira.weiny@intel.com Link: https://lkml.kernel.org/r/20220124013045.806718-1-ira.weiny@intel.com Signed-off-by: Ira Weiny Signed-off-by: Andrew Morton --- include/linux/highmem-internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/include/linux/highmem-internal.h~highmem-document-kunmap_local +++ a/include/linux/highmem-internal.h @@ -246,6 +246,16 @@ do { \ __kunmap_atomic(__addr); \ } while (0) +/** + * kunmap_local - Unmap a page mapped via kmap_local_page(). + * @__addr: An address within the page mapped + * + * @__addr can be any address within the mapped page. Commonly it is the + * address return from kmap_local_page(), but it can also include offsets. + * + * Unmapping should be done in the reverse order of the mapping. See + * kmap_local_page() for details. + */ #define kunmap_local(__addr) \ do { \ BUILD_BUG_ON(__same_type((__addr), struct page *)); \