From patchwork Fri Jan 20 17:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13110334 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 08C7AC25B4E for ; Fri, 20 Jan 2023 17:56:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97E196B0082; Fri, 20 Jan 2023 12:56:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 92EFD6B0083; Fri, 20 Jan 2023 12:56:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CF726B0085; Fri, 20 Jan 2023 12:56:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6A3F46B0082 for ; Fri, 20 Jan 2023 12:56:29 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 40F14AB578 for ; Fri, 20 Jan 2023 17:56:29 +0000 (UTC) X-FDA: 80375932098.20.29416DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 8189D14001C for ; Fri, 20 Jan 2023 17:56:27 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZAKSpo3; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674237387; 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=MdinPY6vQ8fVw027uUZU584MsmM5YD/+rGjhklLF+d8=; b=jOw32X0sssVhx8s2oggXv9Df8qJ4dG5P4KxHquxzQCE2+AnesagR6tv6/RX4VZ2LztioHp 3wrIkEwebG109QHv6fRudod6LygdOQysN9MA2KttEUY/WAhre36r2qUGrcWS75zqNaqBO5 M5N1pXhUGjp4iPXCLerDSYH6U/dyoLc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZAKSpo3; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674237387; a=rsa-sha256; cv=none; b=APkCvD2ByhyMcuXbVYauh1xluWWpq9ngwl1iHobKe+7YKuxS90n1OdHQP1iklcyRTAolC1 SIV9dsvcm77vQOSpec3Wn2Eiau/A30wsIYzcHdJdQOQ29Jnc79FKWFb6Bk2Ceja4336Jw3 uRBq3lAmqiCSmbaJNSxYLui6M5mPuss= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674237386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MdinPY6vQ8fVw027uUZU584MsmM5YD/+rGjhklLF+d8=; b=OZAKSpo3/G2Id5pCOJgTzASzXPqUkotg5iY7jYO1q0SB+IxXt5ARbyodPqCZ+se/3KCGUC ow0bXIllsubhM5OWyt/E49+VpYzdAjmW1nZvlRvIh29WAoMJ3FcqLrhjN9l2YzPpBDrv9p W8nWwTzi+EaRQWuKthEXWnbsIoVNSpA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-XWXguqUFNAG-6TTKujd0rA-1; Fri, 20 Jan 2023 12:56:20 -0500 X-MC-Unique: XWXguqUFNAG-6TTKujd0rA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D11A101A521; Fri, 20 Jan 2023 17:56:19 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.33.36.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id E593A492C3C; Fri, 20 Jan 2023 17:56:17 +0000 (UTC) From: David Howells To: Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jens Axboe , Jan Kara , Jeff Layton , Logan Gunthorpe , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , linux-mm@kvack.org Subject: [PATCH v7 8/8] mm: Renumber FOLL_GET and FOLL_PIN down Date: Fri, 20 Jan 2023 17:55:56 +0000 Message-Id: <20230120175556.3556978-9-dhowells@redhat.com> In-Reply-To: <20230120175556.3556978-1-dhowells@redhat.com> References: <20230120175556.3556978-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8189D14001C X-Rspam-User: X-Stat-Signature: bmh4di8y4udti11f1ue1myjyrdy6puxr X-HE-Tag: 1674237387-993029 X-HE-Meta: U2FsdGVkX19DSZRaG9u8n0LAtK1ny+ziCAnpGgQSC1Apwmwng5Q0lfc5ULGG9mp+47CQ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NS1uGYqdaYxpwn8STM8IF9Do/zWw7PbMylkK9o7bB0R5soNieMKlGHagbKKCSM2XeDfcVT/yP/voQVYa2c3geuQXgx62fS0EKGC7p21iOXx/BXu3Gyclciew4cKSJj0Yw+H5WB015dpI/Kv6EcyB6c1PNZ7ruwDKRqhzDr4pf6zMtxM+Z1aycqE1JoBdw0OVPDj7UrWDGGjpKRfZFLiSUqMJXGfr0x89yYpfjH+2pceMc8F5aTW5ANh51Obcy+ua+M/Au5BtIS3isunCusHxRnXxNRGxpxOpP60dMbSt7/SCfbysOs9UX7EUfa 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: Renumber FOLL_GET and FOLL_PIN down to bit 0 and 1 respectively so that they are coincidentally the same as BIO_PAGE_REFFED and BIO_PAGE_PINNED and also so that they can be stored in the bottom two bits of a page pointer (something I'm looking at for zerocopy socket fragments). Signed-off-by: David Howells cc: Al Viro cc: Christoph Hellwig cc: Matthew Wilcox cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index f1cf8f4eb946..33c9eacd9548 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3074,12 +3074,13 @@ static inline vm_fault_t vmf_error(int err) struct page *follow_page(struct vm_area_struct *vma, unsigned long address, unsigned int foll_flags); -#define FOLL_WRITE 0x01 /* check pte is writable */ -#define FOLL_TOUCH 0x02 /* mark page accessed */ -#define FOLL_GET 0x04 /* do get_page on page */ -#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ -#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ -#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO +#define FOLL_GET 0x01 /* do get_page on page (equivalent to BIO_FOLL_GET) */ +#define FOLL_PIN 0x02 /* pages must be released via unpin_user_page */ +#define FOLL_WRITE 0x04 /* check pte is writable */ +#define FOLL_TOUCH 0x08 /* mark page accessed */ +#define FOLL_DUMP 0x10 /* give error on hole if it would be zero */ +#define FOLL_FORCE 0x20 /* get_user_pages read/write w/o permission */ +#define FOLL_NOWAIT 0x40 /* if a disk transfer is needed, start the IO * and return without waiting upon it */ #define FOLL_NOFAULT 0x80 /* do not fault in pages */ #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ @@ -3088,7 +3089,6 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, #define FOLL_ANON 0x8000 /* don't do file mappings */ #define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ #define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */ -#define FOLL_PIN 0x40000 /* pages must be released via unpin_user_page */ #define FOLL_FAST_ONLY 0x80000 /* gup_fast: prevent fall-back to slow gup */ #define FOLL_PCI_P2PDMA 0x100000 /* allow returning PCI P2PDMA pages */ #define FOLL_INTERRUPTIBLE 0x200000 /* allow interrupts from generic signals */