From patchwork Thu Jul 18 21:26:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13736734 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 6C1E3C3DA61 for ; Thu, 18 Jul 2024 21:26:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B543E6B0082; Thu, 18 Jul 2024 17:26:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B04586B0083; Thu, 18 Jul 2024 17:26:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CD2E6B0088; Thu, 18 Jul 2024 17:26:26 -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 81DB66B0082 for ; Thu, 18 Jul 2024 17:26:26 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3A566C0176 for ; Thu, 18 Jul 2024 21:26:26 +0000 (UTC) X-FDA: 82354157172.20.A1D3302 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf30.hostedemail.com (Postfix) with ESMTP id 765BB80003 for ; Thu, 18 Jul 2024 21:26:24 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=ka5dXIwB; spf=none (imf30.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.170) smtp.mailfrom=josef@toxicpanda.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721337963; a=rsa-sha256; cv=none; b=eVhl1LOeWsmltVL5dUf4Xa5jnTZzj29gsdJYtnIk/rYj/14fQLLNmJAknDn3M2jAgvQTtV 9Xt2YY2b43jyMnsxHMisz0f/+pcTzTfDqQ+IzSLRTUIJ7cLwdcy+kmBZXhZvYvMBw788F4 k2w4SdM3qq916ydTz+oIDjyfywfs4og= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=ka5dXIwB; spf=none (imf30.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.170) smtp.mailfrom=josef@toxicpanda.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721337963; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VeLCrtUWDOmZ/Zjcy+zwponNnjpz5v7iXp/4IVH7M8c=; b=7zK8Fo61CL8Kd1u/3XpvgnlB7seeHHEauoTxehtOYmoVQ/freSSC0AXfSW+nlgpHU8W0Lj gkZImJfY00Y/VbsyDLB2Ls0DDQXVhiHb7RFYJqU3xPeZpLi+qGH1KY6NX94AFkWQDI/grS vFdjNw0VaDFnK+IH/jeHpQXcBeQkE9k= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6694b50a937so1337547b3.0 for ; Thu, 18 Jul 2024 14:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1721337983; x=1721942783; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VeLCrtUWDOmZ/Zjcy+zwponNnjpz5v7iXp/4IVH7M8c=; b=ka5dXIwBLBvFw950x8GN41jffX8sHTAiTG0hYKUalL/E9k1W9ahEYVknSl4SYy5q7x sF38ZGpYlEMgobPGvBdAwfj2wDorsrjfefif0k24sJmnSRGQbRDdVFpc4LddIZDdZBFL HXC6TGB5jmKksVgXAEE35fCRxhpzIdRPMReNctBUk6jt9Ph0DL26E0yhWo/CKhRfAHi8 HS9jFKIYf7FTSOiJGKFkXUawVN6S6sePRFUj/EdnfOQ8eaK5k5U5PPdGfPc9i85nTqhS 2SGC5KVvLGzEdSH09W/wSqOFlgiTDOJpx6ls/FceVn29jwluCBhzvG5Ygr5+EsJ8UwB6 7DbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721337983; x=1721942783; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VeLCrtUWDOmZ/Zjcy+zwponNnjpz5v7iXp/4IVH7M8c=; b=EvcyTL019fnMvmiMrLX16jZvdnRbIhVYJDvmxPG5AL+nobg7qqK034B1aGvPorK6JD jaYZ+iDxs91oWq+avgdN93TlmrYujY9VCTravu6RFqeZDpbyvlsve/emLUj4fz82YqDK T51X8dLfOChcpBKbo7afQqLi7usO459Zshs4Wjr6qM0K/uxClfEbECQ/OfqTfUyFkTS8 mMj9PJXTHgmG+MeibTFHv/sharHrLIQg2u5735Ipg7RG/edoTZ+nMyMJvQ85g/hbANpE JtvR2HvKmQ9ZmKSWVhJK9yQ+3HAgkYu4VpMhCazPaZ4I6Card1JrB5bkF+QsZ1N96Vmb hCyw== X-Forwarded-Encrypted: i=1; AJvYcCUuB6M261DtrMKczu5VQSGBPGS3tehNqhOZU0g6yBAAaW3fA2IVPoeruyj5knONRO1NhjZsySPOLx6E/xBlUN+ooiY= X-Gm-Message-State: AOJu0Yxz8jjPp0L2YZ3EReuPs0wxiE8xig6lukLGUxyogAyjR8zH+flM h4M2OtHoe8EXMRNoW0BhoTGte6dOsslph72RNXnoW2/EEWhrGgqnw8ijnlrjxRtPHEkEwjwveqJ r X-Google-Smtp-Source: AGHT+IFc2dwQh+rfisu4HFiIreoKl5iW23W7I0gxhIn1J2qvF/ve0hTAxKJGkkpddPjGQ4KoMTvslw== X-Received: by 2002:a05:690c:2a89:b0:667:e5fa:5d4f with SMTP id 00721157ae682-667e5fa6363mr27633667b3.46.1721337983511; Thu, 18 Jul 2024 14:26:23 -0700 (PDT) Received: from localhost (syn-076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id 00721157ae682-66951f72228sm377637b3.10.2024.07.18.14.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 14:26:23 -0700 (PDT) From: Josef Bacik To: akpm@linux-foundation.org, linux-mm@kvack.org, kernel-team@fb.com Subject: [PATCH 1/2] mm: cleanup flags usage in faultin_page Date: Thu, 18 Jul 2024 17:26:06 -0400 Message-ID: <2df51a54c06bdf93e1cb09a19a9ef1df6557b59e.1721337845.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: r8opsixpj5j53fwqiehi8sg1myufxj9d X-Rspamd-Queue-Id: 765BB80003 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721337984-793992 X-HE-Meta: U2FsdGVkX1+m3LCnedWzxTXcYZzINrSIyQmUNCU/6/Kyf49mgxGeI2nA9HBNjuzTUX8eD1WDVo4zdPFMCNiHalXjsXkoOx8gEaX0m9yI93ofFq9CWkNiJOnb88P6aT2FIW/9MnFc9fHpbQ6zNh6Sh69NT9gec/qGVGL5G+RwVDc8o4EmlcI1uMvMvabkhaX39lTT8NVgJG8QpQDBoj1lVmjIJODE8aHjjPuvCoX4ZGHPc18dIyinZWEN1kYAzazlgbElQOhHGgZFNGUrqP7B6Fjrt0MIqj66Cd57LatWwpFAIPhqceB4UBw7aBowbskXvU/4gp0gCvqBrMOld8oGQapAoqtBqgM6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2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We're passing a pointer to the foll_flags for faultin_page, however we never modify the flags in this call. Change this to just take the flags value instead. Signed-off-by: Josef Bacik Acked-by: David Hildenbrand --- mm/gup.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 54d0dc3831fb..985d5141592f 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1153,19 +1153,19 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, * to 0 and -EBUSY returned. */ static int faultin_page(struct vm_area_struct *vma, - unsigned long address, unsigned int *flags, bool unshare, + unsigned long address, unsigned int flags, bool unshare, int *locked) { unsigned int fault_flags = 0; vm_fault_t ret; - if (*flags & FOLL_NOFAULT) + if (flags & FOLL_NOFAULT) return -EFAULT; - if (*flags & FOLL_WRITE) + if (flags & FOLL_WRITE) fault_flags |= FAULT_FLAG_WRITE; - if (*flags & FOLL_REMOTE) + if (flags & FOLL_REMOTE) fault_flags |= FAULT_FLAG_REMOTE; - if (*flags & FOLL_UNLOCKABLE) { + if (flags & FOLL_UNLOCKABLE) { fault_flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; /* * FAULT_FLAG_INTERRUPTIBLE is opt-in. GUP callers must set @@ -1173,12 +1173,12 @@ static int faultin_page(struct vm_area_struct *vma, * That's because some callers may not be prepared to * handle early exits caused by non-fatal signals. */ - if (*flags & FOLL_INTERRUPTIBLE) + if (flags & FOLL_INTERRUPTIBLE) fault_flags |= FAULT_FLAG_INTERRUPTIBLE; } - if (*flags & FOLL_NOWAIT) + if (flags & FOLL_NOWAIT) fault_flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT; - if (*flags & FOLL_TRIED) { + if (flags & FOLL_TRIED) { /* * Note: FAULT_FLAG_ALLOW_RETRY and FAULT_FLAG_TRIED * can co-exist @@ -1212,7 +1212,7 @@ static int faultin_page(struct vm_area_struct *vma, } if (ret & VM_FAULT_ERROR) { - int err = vm_fault_to_errno(ret, *flags); + int err = vm_fault_to_errno(ret, flags); if (err) return err; @@ -1490,7 +1490,7 @@ static long __get_user_pages(struct mm_struct *mm, page = follow_page_mask(vma, start, foll_flags, &ctx); if (!page || PTR_ERR(page) == -EMLINK) { - ret = faultin_page(vma, start, &foll_flags, + ret = faultin_page(vma, start, foll_flags, PTR_ERR(page) == -EMLINK, locked); switch (ret) { case 0: