From patchwork Fri Oct 21 10:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13014553 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 8698AC433FE for ; Fri, 21 Oct 2022 10:12:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B9CD8E000B; Fri, 21 Oct 2022 06:12:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB2C8E0008; Fri, 21 Oct 2022 06:12:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 201648E0009; Fri, 21 Oct 2022 06:12:40 -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 ECCC88E0006 for ; Fri, 21 Oct 2022 06:12:39 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CD0751A1355 for ; Fri, 21 Oct 2022 10:12:39 +0000 (UTC) X-FDA: 80044542438.06.DE3FFCA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 895DE18003A for ; Fri, 21 Oct 2022 10:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666347159; 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=QvbHA1NlNVduFtzvLq26bYOPMz6FpLJa39idJS7z9qQ=; b=d0XNkMAB8PgPqA+F7EYVsDBj9Cg/+OuPUWPS4REiausdUHa84OM8vTyN2z1+Gqb57er5jM 8s9wDrvjJdk+I22eIgoI90iIxA3A+KPDJfPUu2Co9L/Y3ARZdCBsh+sv/wR/VZiO4xIIY4 3452pS43bQEwn+DY8wujFKBbXY0b9U8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-ViDLH6jQP72Zr-84yIPLcQ-1; Fri, 21 Oct 2022 06:12:33 -0400 X-MC-Unique: ViDLH6jQP72Zr-84yIPLcQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B6183C0F242; Fri, 21 Oct 2022 10:12:33 +0000 (UTC) Received: from t480s.fritz.box (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31D7B40E80E7; Fri, 21 Oct 2022 10:12:29 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Shuah Khan , Hugh Dickins , Vlastimil Babka , Peter Xu , Andrea Arcangeli , "Matthew Wilcox (Oracle)" , Jason Gunthorpe , John Hubbard Subject: [PATCH v2 6/9] mm/pagewalk: don't trigger test_walk() in walk_page_vma() Date: Fri, 21 Oct 2022 12:11:38 +0200 Message-Id: <20221021101141.84170-7-david@redhat.com> In-Reply-To: <20221021101141.84170-1-david@redhat.com> References: <20221021101141.84170-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=d0XNkMAB; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666347159; a=rsa-sha256; cv=none; b=1ZgZyoC1VcARfXWxc0XjSOdgSnKA2DO6pG7oaaOvOAMnp4MwnZuXumv449KAheRmrd8GGS 8JFliBOPw7frcjac/R7SpEr87Jmx9qDkEawiDy2MP+I2t3VLLRA1s/P8TkIasBvf64BO82 iHvkbu92v46pQVoDBvKCfmjOqUYwXVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666347159; 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=QvbHA1NlNVduFtzvLq26bYOPMz6FpLJa39idJS7z9qQ=; b=LFC/L4MCQsBFQXAXAaB0b9AIeKZ6n4b8pRWZzzH0wRa1iVkym9L14sh0unQeyOMTotK7Pm WGwB/ynplhyiyoTBx2bQ9onNGaAduGTmz23Xd6P6BZORNsc9MOJxs9d7KkSHQihLhCP09U ewosxsMWuMtuOhQUVtfrJhBMUkHoslo= Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=d0XNkMAB; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: 9d8s5pacfxcm1kf9m7qcw5x3p81ncqcs X-Rspamd-Queue-Id: 895DE18003A X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1666347159-226561 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: As Peter points out, the caller passes a single VMA and can just do that check itself. And in fact, no existing users rely on test_walk() getting called. So let's just remove it and make the implementation slightly more efficient. Signed-off-by: David Hildenbrand --- include/linux/pagewalk.h | 2 ++ mm/pagewalk.c | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h index f3fafb731ffd..37dc0208862d 100644 --- a/include/linux/pagewalk.h +++ b/include/linux/pagewalk.h @@ -27,6 +27,8 @@ struct mm_walk; * "do page table walk over the current vma", returning * a negative value means "abort current page table walk * right now" and returning 1 means "skip the current vma" + * Note that this callback is not called when the caller + * passes in a single VMA as for walk_page_vma(). * @pre_vma: if set, called before starting walk on a non-null vma. * @post_vma: if set, called after a walk on a non-null vma, provided * that @pre_vma and the vma walk succeeded. diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 2ff3a5bebceb..0a5d71aaf9c7 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -526,18 +526,11 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, .vma = vma, .private = private, }; - int err; if (!walk.mm) return -EINVAL; mmap_assert_locked(walk.mm); - - err = walk_page_test(vma->vm_start, vma->vm_end, &walk); - if (err > 0) - return 0; - if (err < 0) - return err; return __walk_page_range(vma->vm_start, vma->vm_end, &walk); }