From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71AABC54E58 for ; Wed, 13 Mar 2024 21:55:21 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eyHbBMqp; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eyHbBMqp; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tw47X11SVz3vlc for ; Thu, 14 Mar 2024 08:55:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eyHbBMqp; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eyHbBMqp; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=peterx@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Tw3yj2C61z3cM4 for ; Thu, 14 Mar 2024 08:47:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=eyHbBMqpmOdphPVDHPexS3Ajj36G1vhX7lqr4pB4NOt7QmQhjyIOvV/icmVrMFugV7x5GH z3VNZsGIXt6ughzlXTUes2Vmw8USsMedC2icP47Eu7Py4/LvoObJCBs5aA2dCAIGB9sQ/6 RYlaC9yqhbh+ks+xgNxOpgj7bKgNoHQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=eyHbBMqpmOdphPVDHPexS3Ajj36G1vhX7lqr4pB4NOt7QmQhjyIOvV/icmVrMFugV7x5GH z3VNZsGIXt6ughzlXTUes2Vmw8USsMedC2icP47Eu7Py4/LvoObJCBs5aA2dCAIGB9sQ/6 RYlaC9yqhbh+ks+xgNxOpgj7bKgNoHQ= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-6-vd73jVYoM3aD9T0X57AaiA-1; Wed, 13 Mar 2024 17:47:36 -0400 X-MC-Unique: vd73jVYoM3aD9T0X57AaiA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-690ab2b0de1so1163036d6.0 for ; Wed, 13 Mar 2024 14:47:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710366456; x=1710971256; 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=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=Vmi0RtGbwu7+wqv/+jnRHAn31gk0waXf/221/hzEkHqHyj3i08P6d4mOqpfj/QpDys i8I/Sf9DcqnAtqnLKY1AFPiC/YTJbTTEjDEwQppdVH4ABSeXR9sAwOjbd4s2ih9rkT7b lwY8BIRaKb1F9dwEL9OVScj23K/ZHeFffZ9DqFvekOysWlOa2J45dEBd8+kyW2p7lTHr 17/cTe5wLX4qR798710KiJoOLISLxs2CuiZwHaScHJXbkJZ9rNT5Dbe/i8wluak5ErSJ l4lYZpPue94tCOFfGEDYssuScjE2/+GQcu68yxXEW/7Zyvtfp2pDK/ywpmJvV4/OVvNH vGlQ== X-Forwarded-Encrypted: i=1; AJvYcCVWoUKd+rB49bOf6VSi6ve5dlHABMkYqyPik2vNJiq5VDZ/Vb9avchMnWTWG78vnXlPhXQeKdGeq0lOjHk903ytorO181hfgDhplMKmSw== X-Gm-Message-State: AOJu0Ywg9bfEI+94JZq/dxnm1X1aND5QJLj5WUeQteu/6kaAjwBIgBeY f+xUuaoE2+JWjcbClKshfrsA4GSUl8jRTrvRgoRpNeSd24Z1Ueq7G0df09dN/miJiF82i3/4nqo Hqlg0xXatsopWngqJK3J/Z4qyUHnJuTYg+Vg9OVFCuKy1RnzM2ZqnavksGW4KPJk= X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759451qvb.2.1710366456313; Wed, 13 Mar 2024 14:47:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+HGFdkYe0dzh0k+TaZTCqm6znW50jTd/iFDz8bJGRu/cwrU7vGL7Qd6Yn9XWGaKvseEdKzw== X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759436qvb.2.1710366455985; Wed, 13 Mar 2024 14:47:35 -0700 (PDT) Received: from x1n.redhat.com ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id dv10-20020ad44eea000000b0069111c5cdd4sm60114qvb.100.2024.03.13.14.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:47:35 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 10/13] mm/gup: Merge pXd huge mapping checks Date: Wed, 13 Mar 2024 17:47:16 -0400 Message-ID: <20240313214719.253873-11-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313214719.253873-1-peterx@redhat.com> References: <20240313214719.253873-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Muchun Song , Jason Gunthorpe , x86@kernel.org, peterx@redhat.com, Matthew Wilcox , Mike Rapoport , sparclinux@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Peter Xu Huge mapping checks in GUP are slightly redundant and can be simplified. pXd_huge() now is the same as pXd_leaf(). pmd_trans_huge() and pXd_devmap() should both imply pXd_leaf(). Time to merge them into one. Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- mm/gup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 802987281b2f..e2415e9789bc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3005,8 +3005,7 @@ static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned lo if (!pmd_present(pmd)) return 0; - if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) || - pmd_devmap(pmd))) { + if (unlikely(pmd_leaf(pmd))) { /* See gup_pte_range() */ if (pmd_protnone(pmd)) return 0; @@ -3043,7 +3042,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo next = pud_addr_end(addr, end); if (unlikely(!pud_present(pud))) return 0; - if (unlikely(pud_huge(pud) || pud_devmap(pud))) { + if (unlikely(pud_leaf(pud))) { if (!gup_huge_pud(pud, pudp, addr, next, flags, pages, nr)) return 0; @@ -3096,7 +3095,7 @@ static void gup_pgd_range(unsigned long addr, unsigned long end, next = pgd_addr_end(addr, end); if (pgd_none(pgd)) return; - if (unlikely(pgd_huge(pgd))) { + if (unlikely(pgd_leaf(pgd))) { if (!gup_huge_pgd(pgd, pgdp, addr, next, flags, pages, nr)) return; -- 2.44.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3781B5D464 for ; Wed, 13 Mar 2024 21:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710366466; cv=none; b=BlZPWlgb8i0N01zjMeM7WGAmMCLv9xxnyWahmZk1xRl19BRZf5nyhdPkAjwDSij+XqeJegUfFoFrmn0MtHvGqs4XB4pQ99Y6yu34eM00GDzTI2GEWO96na6u9Dd4Bq01wr7xMuLrOaOiZdJj1viLYN3ejq2qigwmLitzQj9DkDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710366466; c=relaxed/simple; bh=iQQgqfXsWxx8LbxXDlwC+eVTcKSnHUToAbw1far1TeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bl+ImK6D07GxvZt8r/wTGqmUtPPMjd/s3NkjArqy/cu9WAGEGRS+9BzCRYF1QmQGq8gvpIw3keVzAHhAB9DQYRo8u+pZyoX7B7nXMAGCFEYDpY/zGTAgnIm8bDhrirYKTJGDykrLD+0PtM9ruPi/KPOsKXAtxTMzVP2rbwDeBZk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QcSzGPTw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QcSzGPTw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366459; 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=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=QcSzGPTwArZrbnn4lTjiy0r++lcitKJa39yC+BwkChjhhvy03/hr44Ua5PNB0UCEC4FSf6 HjPUvC71PYbzpT5+u7AxrjfkXiTE78gq1172nEU8XENf7fXkGzA3mbA0pDODw236MjGT+V RKcMlIJQhd6u8mPUu89SO2KFaRR0fSM= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-Tqg61XEVN-SNkXZcDAVPpA-1; Wed, 13 Mar 2024 17:47:37 -0400 X-MC-Unique: Tqg61XEVN-SNkXZcDAVPpA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-69120b349c9so1131876d6.1 for ; Wed, 13 Mar 2024 14:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710366456; x=1710971256; 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=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=e9m9hUWevJMGim5zjvMlduri1Zlek6iSQYrxsX0OhPRXBVDuivb1mOv9NYCuaY9EAV IsweeSwhP3+PZMiWzNRveCPULABfNLMBwvoLuWgg9PghLS4TxDvwEdomO7qKNfyjA5oe olTAUifIFMFJF+1/Wr7h8y28aHOV7k6ZPn1Eqsy2Vx7mJsYAS7068Nvp1+ai/lvSQHZl +hGv1gbzA+R8UHhmhPDnDY9JciodxxLJifLvE31XJ7BfveI1/BvS+6lZYxwxFC6HnOB3 eekshm/DF7Ln9F/0caKv8es1IZVOFwyfrTAqWfxnPqB0OODVlzQ5p5BTKj5yItaNwOXq v8JA== X-Forwarded-Encrypted: i=1; AJvYcCXbk6HWePZfDY/QpH20eFTYZOKhzmYG8bC13xxOZO/UqhpF3FCzQ1/zsCkbJhJdyIWcrVZ9TBEYCAl3CXWy3eL4oSqhodZasJ6CVA== X-Gm-Message-State: AOJu0YxgCjC9w/+Mf1Q3pNs7pNgO3lHSnNb4vSIt/TSOtxDOAKg/dl0w G9xLZ7gDfjfimOQ9c8am/YwstqePVU5zXa4TZCGlr3Q1YPZqhdgnhBBcJCGdilGq3J8WDkzvn4t qerQ558BQxC2VYCL/E/ndKjcnVAk8RzD+gQ3Nl5CFLH7qvkPzIhT2x+gCQBg= X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759457qvb.2.1710366456318; Wed, 13 Mar 2024 14:47:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+HGFdkYe0dzh0k+TaZTCqm6znW50jTd/iFDz8bJGRu/cwrU7vGL7Qd6Yn9XWGaKvseEdKzw== X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759436qvb.2.1710366455985; Wed, 13 Mar 2024 14:47:35 -0700 (PDT) Received: from x1n.redhat.com ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id dv10-20020ad44eea000000b0069111c5cdd4sm60114qvb.100.2024.03.13.14.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:47:35 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org, Matthew Wilcox , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , x86@kernel.org, peterx@redhat.com, Mike Rapoport , Muchun Song , sparclinux@vger.kernel.org, Jason Gunthorpe Subject: [PATCH 10/13] mm/gup: Merge pXd huge mapping checks Date: Wed, 13 Mar 2024 17:47:16 -0400 Message-ID: <20240313214719.253873-11-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313214719.253873-1-peterx@redhat.com> References: <20240313214719.253873-1-peterx@redhat.com> Precedence: bulk X-Mailing-List: sparclinux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Peter Xu Huge mapping checks in GUP are slightly redundant and can be simplified. pXd_huge() now is the same as pXd_leaf(). pmd_trans_huge() and pXd_devmap() should both imply pXd_leaf(). Time to merge them into one. Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- mm/gup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 802987281b2f..e2415e9789bc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3005,8 +3005,7 @@ static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned lo if (!pmd_present(pmd)) return 0; - if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) || - pmd_devmap(pmd))) { + if (unlikely(pmd_leaf(pmd))) { /* See gup_pte_range() */ if (pmd_protnone(pmd)) return 0; @@ -3043,7 +3042,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo next = pud_addr_end(addr, end); if (unlikely(!pud_present(pud))) return 0; - if (unlikely(pud_huge(pud) || pud_devmap(pud))) { + if (unlikely(pud_leaf(pud))) { if (!gup_huge_pud(pud, pudp, addr, next, flags, pages, nr)) return 0; @@ -3096,7 +3095,7 @@ static void gup_pgd_range(unsigned long addr, unsigned long end, next = pgd_addr_end(addr, end); if (pgd_none(pgd)) return; - if (unlikely(pgd_huge(pgd))) { + if (unlikely(pgd_leaf(pgd))) { if (!gup_huge_pgd(pgd, pgdp, addr, next, flags, pages, nr)) return; -- 2.44.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 435BDC54E66 for ; Wed, 13 Mar 2024 21:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QXXQs4tR59BhQC/bUWtd00YVgThBVo8KgE5TifBMp5k=; b=ttYCPTB+a9gHwQ aHbNBc4f1Faxw8714ZYB0PWWVBSFH/+gvhaVeuQ28VjOSEXvd97Ee4QOGiZoDFE1/ZIEvMdvsQvH9 9xkfleBwt/VTKy7Ryv4lF4CiJPNXlGJBnSCaoll3Ad2Xv2jtcFGHcDEaVG4hK1xjDV0zLZNwkLWgu 0IV/pA8Ya2Bh3Le6B+rQ3kmT9WOro92r2UcuXe63HmDSaFbwfa06iWMVbRw3IXxsOHPSJGIV5jkmx PuNTLOQ3krWu01uh2IpmNJ7ocsTzvkxKRePVLHIbAL+frzj36yleBb/Nzz4XAasXUPabHH229cJTr OngW8TJc1kmdfvRTjA/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWUW-0000000C1uf-39JG; Wed, 13 Mar 2024 21:50:28 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWTy-0000000C1is-2Gll for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2024 21:49:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=gmd4noEk1rS9cSMXvnK+CCSItJ 8C2Dx16cjAmAphYmr+vW8SarCgC6Vs6FlZSFA/H7XjaTAiwT325o1tMandZFXS5ON/02+j8X/+8My yjkEJ6O5BBv9gnKZ3vh1LnkGYbt1CsY7ymObmEvI35ER9u4KXgDuHFgA2bR+HlnLou3dG+I0IUpxn RNU8Clk25mf0f8uanHasKqnNBclp9gsoYNcy85uHe9TBu7qMmyqm4WHT8lStqJk1lj+FYjaFyKlgL XV4ftWAjNE9h8BmceCrvot/fOMVoad8A5+/8r8yvbJg7ro5XfcImO6r5nun7+lIG+5k86GwWQ88e/ d0O1prPg==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWTu-00000006L5B-3yuM for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 21:49:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=JE2VZNuZHFMHJOjkV0wjdCDrGJHPY9obQ8agH6zCL9cfyPgKGfXU6fqGQEPE6CsDtK+OEB DQq012aovuSzrJB882wL4KhCXZZRz3R0pPnisN9g86CvMM/NMOWKtKMKPjeletA1EMO3Ps /Z8wi3HAtDoApSb2fWHiCm1z/jj63to= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=JE2VZNuZHFMHJOjkV0wjdCDrGJHPY9obQ8agH6zCL9cfyPgKGfXU6fqGQEPE6CsDtK+OEB DQq012aovuSzrJB882wL4KhCXZZRz3R0pPnisN9g86CvMM/NMOWKtKMKPjeletA1EMO3Ps /Z8wi3HAtDoApSb2fWHiCm1z/jj63to= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=OnMpcj+ODXfUi0d3arw9uaoK0V3FR6fg4TdHYbvhgZNX3WI6MRviiRG7yoosA6s68jYD+A U4/rHqeD0jIE+9Vf0scrdhqTcWjqLAcDrvEuImkvpuumvB2u3c8eu5SVsh+K+NQo1Y7yh/ +LZb6yIPgC12GoY1LcRF9/wK/+1Q9Ds= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-iZgH5gPyPYWlsx_oYH8cgA-1; Wed, 13 Mar 2024 17:47:37 -0400 X-MC-Unique: iZgH5gPyPYWlsx_oYH8cgA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-69120b349c9so1131836d6.1 for ; Wed, 13 Mar 2024 14:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710366456; x=1710971256; 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=Z0Y+ceGC2u4mzi2lycxKAqHeA0qAqllKwMSRaV+2/Lw=; b=dzYIGzr+h4CbjEjx1p8L6J0qZpXBHSLKuSxsWgBsfc+V6P0iQebgD9j9QRUOnrHXU/ XXbFqnmU6VHsZXJKoizwfD5G8Twgkh09ZGLL0RsgYWA8Ahw9sU1JZkIDSOw1gHWffmHU DM8FZSQPmfc2Yvd2QtB+ihC09wEVUSk3QU/Yslw/ta79ef1KwNGVxdMsq/DCkyaVDV81 FHr8+l0oYRPwKYfTvBryVtveDCirmDHTqClc1cT+UbXyTcpEdKKf0IX/ptzLDdgFFs1T ZeEY5dvOTPIX5eH9Bh2dH5CHx1hK05tjUm5cWLCD8NrPthRSVSglgISEM91U46Bilmm1 exig== X-Gm-Message-State: AOJu0YwTq4axkq7LJINoCSY9XXSAgIsyuJJ3WtshsByym2k4NY6QCwb1 v4KAKmc4+6ti6GA2RTnE/qeY2EE8pX3BWYEocNdnRLrQd2i8G6nUO2LOxDDL090DBQ2j7kKHiYZ 3tk/CmHZnO27Mw02IKc43M+aITZs8nuT9tvs8GTlt+hc5qbfBuYmlCFhVndtADPOqtZWGiS2d X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759450qvb.2.1710366456313; Wed, 13 Mar 2024 14:47:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+HGFdkYe0dzh0k+TaZTCqm6znW50jTd/iFDz8bJGRu/cwrU7vGL7Qd6Yn9XWGaKvseEdKzw== X-Received: by 2002:ad4:4c41:0:b0:690:c64d:c2 with SMTP id cs1-20020ad44c41000000b00690c64d00c2mr5759436qvb.2.1710366455985; Wed, 13 Mar 2024 14:47:35 -0700 (PDT) Received: from x1n.redhat.com ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id dv10-20020ad44eea000000b0069111c5cdd4sm60114qvb.100.2024.03.13.14.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:47:35 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org, Matthew Wilcox , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , x86@kernel.org, peterx@redhat.com, Mike Rapoport , Muchun Song , sparclinux@vger.kernel.org, Jason Gunthorpe Subject: [PATCH 10/13] mm/gup: Merge pXd huge mapping checks Date: Wed, 13 Mar 2024 17:47:16 -0400 Message-ID: <20240313214719.253873-11-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313214719.253873-1-peterx@redhat.com> References: <20240313214719.253873-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_214951_130247_6E143743 X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peter Xu Huge mapping checks in GUP are slightly redundant and can be simplified. pXd_huge() now is the same as pXd_leaf(). pmd_trans_huge() and pXd_devmap() should both imply pXd_leaf(). Time to merge them into one. Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- mm/gup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 802987281b2f..e2415e9789bc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3005,8 +3005,7 @@ static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned lo if (!pmd_present(pmd)) return 0; - if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) || - pmd_devmap(pmd))) { + if (unlikely(pmd_leaf(pmd))) { /* See gup_pte_range() */ if (pmd_protnone(pmd)) return 0; @@ -3043,7 +3042,7 @@ static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned lo next = pud_addr_end(addr, end); if (unlikely(!pud_present(pud))) return 0; - if (unlikely(pud_huge(pud) || pud_devmap(pud))) { + if (unlikely(pud_leaf(pud))) { if (!gup_huge_pud(pud, pudp, addr, next, flags, pages, nr)) return 0; @@ -3096,7 +3095,7 @@ static void gup_pgd_range(unsigned long addr, unsigned long end, next = pgd_addr_end(addr, end); if (pgd_none(pgd)) return; - if (unlikely(pgd_huge(pgd))) { + if (unlikely(pgd_leaf(pgd))) { if (!gup_huge_pgd(pgd, pgdp, addr, next, flags, pages, nr)) return; -- 2.44.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel