From patchwork Mon Oct 2 23:14:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13406614 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 EFF28E776D4 for ; Mon, 2 Oct 2023 23:15:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 681F68D001D; Mon, 2 Oct 2023 19:15:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E3998D0003; Mon, 2 Oct 2023 19:15:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AC108D001D; Mon, 2 Oct 2023 19:15:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 32F518D0003 for ; Mon, 2 Oct 2023 19:15:05 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 04C05120108 for ; Mon, 2 Oct 2023 23:15:04 +0000 (UTC) X-FDA: 81302078970.16.C3DD649 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by imf20.hostedemail.com (Postfix) with ESMTP id 31E061C0004 for ; Mon, 2 Oct 2023 23:15:02 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CqtFSWLu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696288503; 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=8CCf1YepfoJnZdTtxvEP7yh6ZYqHtmpLJthLBvRpqWQ=; b=1x8bORuIsMimrQoPR2HekviVBnSH2x8ORqulc7oKV1CrmWH52dXWfdiMxyvnUfdeWk2KT0 aqc8os6tZPrAH30yQl4vv79TcxmYtAvRSxEsAquBIojuxEKK/em3a8tO3JMzbBLPbKrFF6 N/0kxClhFUZ/7v9VUFTJk0CrGgf78js= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CqtFSWLu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696288503; a=rsa-sha256; cv=none; b=WuHsiQD/tkNic3ncglgjtKCMLJfxJhGL30DlpA9Jos1NPSBLHPuYlpN+zUQvXIwmC4iFYL BDf91F703mCVWUFTn7g7IwvZMxeIS0PawrinOEQzkmxk2eAO+91gwuffusbzCT7VJNsrnT coVpi3rFVg8rqbM09GUGWSqIo7kl3+0= Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-31427ddd3fbso360937f8f.0 for ; Mon, 02 Oct 2023 16:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696288501; x=1696893301; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8CCf1YepfoJnZdTtxvEP7yh6ZYqHtmpLJthLBvRpqWQ=; b=CqtFSWLu4v/t363O9nTF5uTVSA2MVpxqgRzKPJZRsQ/C8BBGLhJjsfaAYAW9+Juc4+ cmNDzdH9fCjRc+xArkpIKAQB0uNWFcatO2FnF2AU27IoioW0GrzVaqfTW0suSqeP2Uf7 qfwyOCnkDd2QIsrusm8Wen68tB3tP3JszzScocFjKCrJt5tSNebBMtXI8YvysQ1ty9yS uWAVmeeTyICigXXESg6niMJhf5Jq4nrDJ/G54uwqoi+nKCF8ABvb4MvM99aKDB1oDlf3 NjTXG3TC0pD7QDx47DgF5rLQnOzCF7RZvbInC+TmLDUdRtdQvRCUuourY3Mei+ZmlMye WNlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696288501; x=1696893301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8CCf1YepfoJnZdTtxvEP7yh6ZYqHtmpLJthLBvRpqWQ=; b=RwEIEOibmZgoEQ4Ptrfn0NsyaPLDvI2K+eifSGJV83xufio7Osb25G5GenOvSCLdDh 9a1ixd5azl6VcBufxRRu3d+Q/brZT2Lqdcchp7RjLgoFcD0xz6AKNWCFkB3nxaPCC05c R00g8asbleZjXA6/KFxnhCW6L4fsFYX1c/5nq/rGo+v89smjMC0CujSGhdGh+vDQfUJZ JO0i9JLP37722npKgmihfZpbXXi3h2Hhbjh24nvYGPXfV4P9Rn7dlroPC0mNPIc8/HrH ZCV5szvSSrR/sYmf2M1P6MXxArxzfcPT9g5j7XiD4U7wTcOK7Bnjj6qpqxlEXWHMsHsL +NlQ== X-Gm-Message-State: AOJu0Yws+geS2v9wVMKbj/cSu9kfJqSrhfft0abZW9VSFkFsTK3G2gbb f7VbRcXtTYn0F1RZpDoej+sc85aCITw= X-Google-Smtp-Source: AGHT+IHYriSecsmHZKvTmAjWX2tjh39AdJdHel618pmJyi/BsoVQvDJMPZheisgXAY/d1NQdCOZsLw== X-Received: by 2002:a5d:4dcc:0:b0:320:5f:c249 with SMTP id f12-20020a5d4dcc000000b00320005fc249mr11333408wru.30.1696288500995; Mon, 02 Oct 2023 16:15:00 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id e31-20020a5d595f000000b0031fbbe347e1sm63860wri.65.2023.10.02.16.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 16:15:00 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland Cc: Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Oleg Nesterov , Richard Cochran , Jason Gunthorpe , John Hubbard , Arnd Bergmann , Lorenzo Stoakes , David Hildenbrand Subject: [PATCH v2 1/4] mm: make __access_remote_vm() static Date: Tue, 3 Oct 2023 00:14:51 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 31E061C0004 X-Stat-Signature: m4mu493zojkx9y9wszygyqc4133pifri X-Rspam-User: X-HE-Tag: 1696288502-128815 X-HE-Meta: U2FsdGVkX1/FbS2YFqDzRN2OL1We1LJirb7TyIcqee9QLIrCXd2LqKLHDZ+RhSpfOLuH7BpzhJuU+hHGY3TFva8X2Gca+p1ogwKA01y0np3asuCNGhIt3EwlpZyMcp29ZAOXIbyohQdy+bQzwRgfcCN6fdDsNiz++K8wZ0FdqEEGZAzWd9UsCUzinUvn54/EGq4Pt3R3ZHU+lLaPqzP5/eeigouELO98Gn6EGAOydg0pjw/7QXQTRoQi1BiR102GN+TinklnbhVD85tLcCtFwTyPpOYI2hupMLrbLYwfRA+5XT6aLRIf6o3i0bMnbDxTjU6fF+h2m+PqXzBFgaaGdugDNSaLDhblOs7f1BEX85rFmP0R2Rt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m9HqGiFSgZkeSJhFyq1Ic6IOQm8lpBww== 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: access_remote_vm() passes through parameters to __access_remote_vm() directly, so remove the __access_remote_vm() function from mm.h and use access_remote_vm() in the one caller that needs it (ptrace_access_vm()). This allows future adjustments to the GUP-internal __access_remote_vm() function while keeping the access_remote_vm() function stable. Reviewed-by: Arnd Bergmann Reviewed-by: David Hildenbrand Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 2 -- kernel/ptrace.c | 2 +- mm/memory.c | 4 ++-- mm/nommu.c | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 52c40b3d0813..7b89f7bd420d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2415,8 +2415,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, unsigned int gup_flags); extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, int len, unsigned int gup_flags); -extern int __access_remote_vm(struct mm_struct *mm, unsigned long addr, - void *buf, int len, unsigned int gup_flags); long get_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 443057bee87c..d8b5e13a2229 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -59,7 +59,7 @@ int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, return 0; } - ret = __access_remote_vm(mm, addr, buf, len, gup_flags); + ret = access_remote_vm(mm, addr, buf, len, gup_flags); mmput(mm); return ret; diff --git a/mm/memory.c b/mm/memory.c index d4820802b01b..e2743aa95b56 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5881,8 +5881,8 @@ EXPORT_SYMBOL_GPL(generic_access_phys); /* * Access another process' address space as given in mm. */ -int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, - int len, unsigned int gup_flags) +static int __access_remote_vm(struct mm_struct *mm, unsigned long addr, + void *buf, int len, unsigned int gup_flags) { void *old_buf = buf; int write = gup_flags & FOLL_WRITE; diff --git a/mm/nommu.c b/mm/nommu.c index 7f9e9e5a0e12..f9553579389b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1651,8 +1651,8 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, } EXPORT_SYMBOL(filemap_map_pages); -int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, - int len, unsigned int gup_flags) +static int __access_remote_vm(struct mm_struct *mm, unsigned long addr, + void *buf, int len, unsigned int gup_flags) { struct vm_area_struct *vma; int write = gup_flags & FOLL_WRITE;