From patchwork Mon Aug 21 20:20:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13359786 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 CF395EE49A6 for ; Mon, 21 Aug 2023 20:20:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 385F494000C; Mon, 21 Aug 2023 16:20:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30C0E94000F; Mon, 21 Aug 2023 16:20:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 070BE94000C; Mon, 21 Aug 2023 16:20:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E485494000D for ; Mon, 21 Aug 2023 16:20:26 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BFA331A0C22 for ; Mon, 21 Aug 2023 20:20:26 +0000 (UTC) X-FDA: 81149229252.26.ECFD3EB Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 2C69F1C0006 for ; Mon, 21 Aug 2023 20:20:24 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=RhSHMGYj; dmarc=none; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692649225; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZjTkkOXXXSSKh7AkJZazpX1s5qsUP26GHpbaGZUnTo8=; b=Q84iu4X7OskoyEkEDf8LmCgSuKO+MaewNycmfPBYVZvnpYHkjfMWLzEQJx9d3oqhcKtb0e rteeVlK/HhHfnHAvANyj8PJHSMRfvlqscb+35lEogCZzvQt1GlgXce5ELK9uf0Oxb/ED/h 914YNcgM104TdBNBmlyDcPt/S6irkM0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=RhSHMGYj; dmarc=none; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692649225; a=rsa-sha256; cv=none; b=C2CkmCZioMTkGwFMjnAz0tCK7GbJcfBNk+JQTY56ScYpO27eSftblPD8UnuntlSyvyAgt4 EXz6BCLL9U6ejGgJnwfqilaeR5oqTUdk3RJ5mj/L0agadJQlJZHuEvyWkqWOn3Q7CD+6RF /Yw0sfDxYeY4POemueefiwb78p7Q84Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ZjTkkOXXXSSKh7AkJZazpX1s5qsUP26GHpbaGZUnTo8=; b=RhSHMGYjzeabO+TPC6Vk0fsGAP ESwQD+kA9n05mFH4V7x5E1E/PK7+hX6AVEwb0xfW5mvuGVGJgTKBnfxSxTrNj9bcH6p//Sh8Ak0uq rPvFNvCQYo+40HrjKlG+G2jBE3tczpJuiIIO9bhjugOITLwOZalFgpX/o5/DZfdiMbMgRwny1WOEN TVHwPs+hl9Ud0NYAy6FhPagROuHL0gCeWZ/nij+EVwy9Nu6WS1aGddneN0uBfZEpYcAEwIxdTi+Sc 3SSVYmvOzhYL04ZJaaKKd5yd719t3TJ4WW2WFT7uVRi/f6Ycmzg3N8KIwx/VWQCKMFfHizqP5zsRC kUFKWb8A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qYBNr-00CD6y-Av; Mon, 21 Aug 2023 20:20:19 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-perf-users@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, urezki@gmail.com, hch@infradead.org, lstoakes@gmail.com Subject: [RFC PATCH 3/4] perf: Use vmalloc_to_folio() Date: Mon, 21 Aug 2023 21:20:15 +0100 Message-Id: <20230821202016.2910321-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230821202016.2910321-1-willy@infradead.org> References: <20230821202016.2910321-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2C69F1C0006 X-Stat-Signature: sohszagjrxbq8qkr68k7iqijjm1qjhgi X-HE-Tag: 1692649224-674452 X-HE-Meta: U2FsdGVkX18XCyvxZfgLaKFoQAezc6e4aXdvb68qdd9Wq07VwEJiTQeE36xvDiL/FDJzrnPyTJ0TdX5y58Va7XQF/G3ejSvApgelgn9nndkJlv0MEQeCZXgh8jPRAvVnNFtM5D4XGDcJc6hhNSV35orLQoTsDiLfQvcGGyigDAgsO7wuXfz12iskDLjTnq/PBymh4SX5vIq2+rbwAEuuuFjKVWEyhKrHX0S4CLQX+LmZcCvEcm1MXF1TVwVSP+2Xd4APO7EAqOy0RIb5pwRDIBSGE6Ilbp0FguuXOk1ddMLStNdH6eqEM0eAW4koZ9pX6yaUBpNm/TXClNX+jprIe3lYgzrv9eXN09PZuwb9iR9NVGAGO0qIdBC06uNeta1i74y7f4KDmbcxCg13Y/hyChpW7BKw8qnz29A//KbKHQWWtKNWW+p+Lvi+9Sus2U11WR8Z8mqxglQ9iieVukrofITw2j4XxTW9ath6znCRM1We9mZPafandlCwEizUKWKvusa0boXijd0/QMC72a12BmZSTaqwIzExmuEKv4wRLa0K9Z2NNgcpjNQjnQEk9t+w5zG45LW4aJWwrmEDsQ3VliSew8wApn31gZUWEWcnz7Ja7arMQuRjfz9w7+bMuiPVu0A7tnK1E2SVGiltmyGNr0S0s1T4QQ3VVTKQW8QVNPufM6SVFgQ6TxYwskkTSaKkMaJu0xY5yQIDkL2zC03vWZ7xHBecXuF7sJktVR9HspzE/wPIwp8whEGaOKjPiY1802CCBkiB8JHuePQrMZNDGgWGAXUnb7NcrdwT97RjQpi59kv2HLvHy9HRQOxSlUcrW2zvcCLR+2fnsZYscHx0Xn8jDGuIx6t5CMUraiSHL8+0exfAVtwgTvHGNFvs1W/NFZNSTJ98h0qqJfNwO2ez6H//llQY7bBu46d4j89SB/xjtD7QfKEUthHoKcimNnU3bEdopGxoN4cs8mJ33qN 9bWT4KFc tBzvscn0FtZ1klhQH16b/VDdRQ96dTS20+q79QLHtqdoJ9A0C5kSQeWI+VwvAZEgE59Zyn/0IbXjJ6EDe4QQA6/icxLNS3V/2HezeUs9Q9lSATOYF6BH5lBXfijhhjkF9a/jcLpc4vGUvIGW5aFcJytc8+ktoFZOwoVUEdHpVgXm0hEIT41GDAQPHOxG+yx0ZnW8lgDIzrYmHWQSrMbPCB8HfUOI640qFoNpP 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: Eliminate a use of page->mapping by using vmalloc_to_folio() instead. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Lorenzo Stoakes --- include/linux/mm.h | 5 +++++ kernel/events/ring_buffer.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 840bae5f23b6..7d84a2843193 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1134,6 +1134,11 @@ int region_intersects(resource_size_t offset, size_t size, unsigned long flags, struct page *vmalloc_to_page(const void *addr); unsigned long vmalloc_to_pfn(const void *addr); +static inline struct folio *vmalloc_to_folio(const void *addr) +{ + return page_folio(vmalloc_to_page(addr)); +} + /* * Determine if an address is within the vmalloc range * diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index c73add132618..56939dc3bf33 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -873,9 +873,9 @@ __perf_mmap_to_page(struct perf_buffer *rb, unsigned long pgoff) static void perf_mmap_unmark_page(void *addr) { - struct page *page = vmalloc_to_page(addr); + struct folio *folio = vmalloc_to_folio(addr); - page->mapping = NULL; + folio->mapping = NULL; } static void rb_free_work(struct work_struct *work)