Message ID | cover.1696174961.git.lstoakes@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp971111vqb; Sun, 1 Oct 2023 10:06:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjO7Omc3M0v69qoAxRY+6+racFICBhgX72vbm2Fm9MMmdfdrO62Z5Pzv8UeOfMPXkKr0jY X-Received: by 2002:a05:6870:f10d:b0:1d6:617d:62eb with SMTP id k13-20020a056870f10d00b001d6617d62ebmr11421023oac.39.1696179985188; Sun, 01 Oct 2023 10:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696179985; cv=none; d=google.com; s=arc-20160816; b=cSorhKJSA4wYV0FHFsIPpqxa4EPFHCBG/gLnw202Y7l4CXZiX0Dt/Gp+pGTrkS4Fp5 uBPnCI/lYkeZZ6bbvH0Db19bLqbGs0cYiuV4ixIMp1ML+we2Os4YRNFlDEjI3M1Dw5dW uojjmH5uOKhpqXZJNlXdyK0ArjWTKxdXpjZfkhqeKerQa+tshyJMaADPvW0IGsk+sJ8S VM1qz6qgFEGJBxFekb4aJlfAtnyZI8T128/ixDt1IlqX9vEzECfxNUiRm5TfGDlVbgv2 CnBJlLvbpS1mQh/0vDEBxN4IAbXyso/t99awPHWXm6oXfo+zbmIUIJFu28dU0vQ6VDIp G+NQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; fh=mNvOpR73OaUnRrr53gRvslddDUjaIrpQi7RNpkp0Veo=; b=b88aluOWxPjkS+1Dz4O+djy2Z4adBix26azPFbgE551MSV4tNpcKGbrMzON7IhXfRM fcapSjcR4ZlGPng9poF01munkSqjTlO5GMvjHgF40mFADD3TDNq1IyqsGKpJu2qd0mnM h8xCoAAw7sKvW3srds2XLx7/71ijV76IDhZ4NJK13t3ZPzFJg81PQczq4BOmuq4GgobK mWg/sF4eH/UFe9F8yZH179xmXG/y7avv9YWmZlEh9jKrsIJ+f0Q8uC3kueNz3LyFNRFg OUEDkIw98B8eMk0rDVsL3N+7FVRoughkjYXKVbf0qlMWzW7LvOfhn3Aunw1FSKhT3I9y DQsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IVRm8T0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l191-20020a6391c8000000b0055c8d58cee9si25774795pge.714.2023.10.01.10.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 10:06:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IVRm8T0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C4DFF80CF556; Sun, 1 Oct 2023 09:00:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235183AbjJAQAO (ORCPT <rfc822;chrisfriedt@gmail.com> + 18 others); Sun, 1 Oct 2023 12:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235093AbjJAQAN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 1 Oct 2023 12:00:13 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB3A0DF for <linux-kernel@vger.kernel.org>; Sun, 1 Oct 2023 09:00:10 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-406402933edso73933055e9.2 for <linux-kernel@vger.kernel.org>; Sun, 01 Oct 2023 09:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696176009; x=1696780809; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; b=IVRm8T0V976mZ9cTdEnp23eUgJqclHZFvpe5N6nVDwaCGxt8aYCLNtA5lRF1MpPyUv 1XjtCpfA2GBvPb4ysyuutwMdTN2mw9cIU86LpPVaYHWXkhGBvR3Vfjbry2euyn9yKSKu k4KA90KaSJzrOsqqOG355vhEVv+/zoL32ibAJfpodhFLuamR7q2ll6KCKxO3g7UNJ/i9 WoqoTf3zRg2iERk297zbpPeMlyz6+EaXVurZ9OvACAmmxCFFgeC6oD7McpQVeq0SnAnL xcAHJJuHopkI/wJ6YJoJhhG6xHVTNVktruod3QpZGW2HPNlMHLyQfjkF3Ccqs6vbDdl+ ijmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696176009; x=1696780809; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; b=bp+pw1DAJY+puMzIEebxSdQpoz2o/DJq3YcxBGH0dp1LxSPwRw4s1OueSvU4qt9o4d xWwoip+04JFlWKFkqof2SGVaKDh2tqdevQ5o0uscf0myHnmiH353zyx/FRR831yCys80 O/ZK1vaPqEwqhEk/KQIf1vu+rDkS2kpjQ/cm5zmK4ruYHgGIbYLgltLHOeOXqID5C8R/ IGBYx36eV45Zt50Ykcp8fBNFfha1KuLlG06m+TSgt9DXViLz10fzaO1O06YXcNcfaIny 1Mt4mbmAXlFZSt8tsj3K87wXbPeO0TNC2cW7OpUQmER71/fcwG0CBHGrWKy01n1npGKq 2GFQ== X-Gm-Message-State: AOJu0YzDovH3uxB7PgA6HXtfWfdwh0VN3bQ6Z4Lwp5LXq5narPR6DU8f /3oo861ooIhv6Mrc9fmPeDM= X-Received: by 2002:a05:600c:6027:b0:406:535a:cfb4 with SMTP id az39-20020a05600c602700b00406535acfb4mr7987766wmb.1.1696176008738; Sun, 01 Oct 2023 09:00:08 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id s16-20020a05600c045000b0040536dcec17sm5487695wmb.27.2023.10.01.09.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 09:00:07 -0700 (PDT) From: Lorenzo Stoakes <lstoakes@gmail.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Oleg Nesterov <oleg@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Jason Gunthorpe <jgg@nvidia.com>, John Hubbard <jhubbard@nvidia.com>, Arnd Bergmann <arnd@arndb.de>, Lorenzo Stoakes <lstoakes@gmail.com> Subject: [PATCH 0/4] various improvements to the GUP interface Date: Sun, 1 Oct 2023 17:00:01 +0100 Message-ID: <cover.1696174961.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.42.0 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 01 Oct 2023 09:00:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778573624151159685 X-GMAIL-MSGID: 1778573624151159685 |
Series |
various improvements to the GUP interface
|
|
Message
Lorenzo Stoakes
Oct. 1, 2023, 4 p.m. UTC
A series of fixes to simplify and improve the GUP interface with an eye to providing groundwork to future improvements:- * __access_remote_vm() and access_remote_vm() are functionally identical, so make the former static such that in future we can potentially change the external-facing implementation details of this function. * Extend is_valid_gup_args() to cover the missing FOLL_TOUCH case, and simplify things by defining INTERNAL_GUP_FLAGS to check against. * Adjust __get_user_pages_locked() to explicitly treat a failure to pin any pages as an error in all circumstances other than FOLL_NOWAIT being specified, bringing it in line with the nommu implementation of this function. * (With many thanks to Arnd who suggested this in the first instance) Update get_user_page_vma_remote() to explicitly only return a page or an error, simplifying the interface and avoiding the questionable IS_ERR_OR_NULL() pattern. Lorenzo Stoakes (4): mm: make __access_remote_vm() static mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH mm/gup: make failure to pin an error if FOLL_NOWAIT not specified mm/gup: adapt get_user_page_vma_remote() to never return NULL arch/arm64/kernel/mte.c | 4 ++-- include/linux/mm.h | 18 +++++++++++++----- kernel/events/uprobes.c | 4 ++-- kernel/ptrace.c | 2 +- mm/gup.c | 16 +++++++++++++--- mm/internal.h | 3 +++ mm/memory.c | 7 +++---- mm/nommu.c | 4 ++-- 8 files changed, 39 insertions(+), 19 deletions(-)
Comments
On Sun, Oct 1, 2023, at 12:00, Lorenzo Stoakes wrote: > A series of fixes to simplify and improve the GUP interface with an eye to > providing groundwork to future improvements:- > > * __access_remote_vm() and access_remote_vm() are functionally identical, > so make the former static such that in future we can potentially change > the external-facing implementation details of this function. > > * Extend is_valid_gup_args() to cover the missing FOLL_TOUCH case, and > simplify things by defining INTERNAL_GUP_FLAGS to check against. > > * Adjust __get_user_pages_locked() to explicitly treat a failure to pin any > pages as an error in all circumstances other than FOLL_NOWAIT being > specified, bringing it in line with the nommu implementation of this > function. > > * (With many thanks to Arnd who suggested this in the first instance) > Update get_user_page_vma_remote() to explicitly only return a page or an > error, simplifying the interface and avoiding the questionable > IS_ERR_OR_NULL() pattern. > > Lorenzo Stoakes (4): > mm: make __access_remote_vm() static > mm/gup: explicitly define and check internal GUP flags, disallow > FOLL_TOUCH > mm/gup: make failure to pin an error if FOLL_NOWAIT not specified > mm/gup: adapt get_user_page_vma_remote() to never return NULL I don't normally review mm patches, but I had a look since it was started by my earlier feedback. It all looks good to me, very nice cleanup! Reviewed-by: Arnd Bergmann <arnd@arndb.de>