Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2086215pxp; Fri, 18 Mar 2022 02:56:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx88HOIXzxHxoxaIX7H54nAUu0VZQzlgSSEpmdABlm5TesRE2xu/8OZLROtzNGAC7m/LIQR X-Received: by 2002:a17:902:c215:b0:153:8d90:a108 with SMTP id 21-20020a170902c21500b001538d90a108mr9345820pll.172.1647597394819; Fri, 18 Mar 2022 02:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647597394; cv=none; d=google.com; s=arc-20160816; b=zEkgFkHljRWfiiNm7hdntKS/4+RqPIh3AhKXXX7bl88BX4aScXMku1AFioInJp4uAJ 9Gig12B8oC0P7AlyK+sv4HPyeOC+KiI7PIU2xFrL/ytw4HmuC94g+pggNEomdmGuBLaQ h0TWqJ6lymC8pNpv4jB2j7x6LQXibnB2zdA63EUHpti0wWxr5cKZsWuxFoUCeJg7runZ hZYmDaZ794ROIldMp/pKuiIA+XeGmYhwwcQ/PmKnFUmo0mP0d9R0d001xFGPbKFfZJ2F KIbrJhdUXyc09K6oe8hcCM7XfiBz1F+/1TNy0OeBHPTwDPVbTmTrlskoMCsXtU5g0dSR 3dfw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lWUQux1KtYb2lW/SJw8SxLz0dcCTGFUlQsH2e++z+XY=; b=0pam6tc93e6uBJp4VDcRUI+5ygkJzoaedghzFdOKnBajpm6pcGg4+6pm3Czf9EMCaz Ecaiexocc2KRvKrujPEpYpgoAPFWsyzca2vO8VlCoDfu9lpd8Z51irwmxUv4VuRsujmx lfYKFedlWkobyfq8mUC1swkDrsw6PMUTd7D8GvzyUWZtSkRFpuJfAGMAaVS95GJ9s/8A QeKDBgid0dBu7EKdlkQJ0ooWuIrpjgiE6V/SuFjwO4hyQ5T9WNLohSl/JrzC9NX7qo0u hv8ob7MGq9hKL7dT7Y9achhG/yZSPYYtcTW4MKWisI0V280cq9b31pjWOmWbapALshbO cbKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=5bzBbr1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c65-20020a633544000000b003816043f01fsi5380949pga.532.2022.03.18.02.56.23; Fri, 18 Mar 2022 02:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=5bzBbr1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233295AbiCRHtW (ORCPT + 99 others); Fri, 18 Mar 2022 03:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbiCRHtT (ORCPT ); Fri, 18 Mar 2022 03:49:19 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E89F25EB for ; Fri, 18 Mar 2022 00:47:53 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id t14so4524845pgr.3 for ; Fri, 18 Mar 2022 00:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lWUQux1KtYb2lW/SJw8SxLz0dcCTGFUlQsH2e++z+XY=; b=5bzBbr1D4egu3YxUjV6NU5rP+tmRTfoCbQCHzoz5dOiFVKlrS0cw7ippuefsHKLsCE fo2HvaJglETK9wm68r8dOlew9nAPqA9sQV27lJoQ/riPuNKVaTkiLydUSvyY34v/4Szx k2dwX1GB3beaot9LSmk0kJilr/Wox9GEY6UR+NAqpsr8eEAaPXoO62fSz6cfSarCvKXY 9PsV2xjPoa0/pke7OOwVOG768pLYDkFnAjWM8MrCHQWxTr8R8BqWDVB6TXE2OxVtxxmv S2p74U/apcotkbr8QzaAIeNAWsiOhvvfleiiDpIjzQhmtA6v39V4Pp/Goz4/EHviNis0 f85w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lWUQux1KtYb2lW/SJw8SxLz0dcCTGFUlQsH2e++z+XY=; b=TPyj/Z1CMUS/kOD7w8ewyks38idXTicemnKBbmLfoas/sWdp4AR0hgeCsUjRRF7hcq BMOwQeSAMeL6T5wrAhn82MUrd7CFE448cS6LjD68L6/SjwYRTE61Wv3MeDgj9i9eRuYF PaNtO+ogf4ADBUqaztc3DAwuMJZlkJPDJI/XhxMdfbsfa+87VmqddRQt0B7cZ26OaZN1 x9sSHq71jmug9TloOK88YukKMq6X9AqxXjQHLUyJoxiCcEPf/Ug9D8JMry2Ewe4Z5zXl iWT7s8vf+TLRoISTO+yc8LBhwd1rIXjHjEkVEGgFmP2316xZ1ja23Ai2jdnuzsZd8AEt HsAA== X-Gm-Message-State: AOAM530PthmyxRm6STAl2muazRmNYavKD5MI33kAl2f7xla30dFDaRsr kipN+IRyVS4apfG6qqwpUWmdaQ== X-Received: by 2002:a63:1758:0:b0:381:effc:b48f with SMTP id 24-20020a631758000000b00381effcb48fmr6973156pgx.124.1647589673409; Fri, 18 Mar 2022 00:47:53 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.233]) by smtp.gmail.com with ESMTPSA id a38-20020a056a001d2600b004f72acd4dadsm8770941pfx.81.2022.03.18.00.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 00:47:53 -0700 (PDT) From: Muchun Song To: dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, apopple@nvidia.com, shy828301@gmail.com, rcampbell@nvidia.com, hughd@google.com, xiyuyang19@fudan.edu.cn, kirill.shutemov@linux.intel.com, zwisler@kernel.org, hch@infradead.org Cc: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v5 4/6] mm: pvmw: add support for walking devmap pages Date: Fri, 18 Mar 2022 15:45:27 +0800 Message-Id: <20220318074529.5261-5-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220318074529.5261-1-songmuchun@bytedance.com> References: <20220318074529.5261-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org The devmap pages can not use page_vma_mapped_walk() to check if a huge devmap page is mapped into a vma. Add support for walking huge devmap pages so that DAX can use it in the next patch. Signed-off-by: Muchun Song --- mm/page_vma_mapped.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index 1187f9c1ec5b..b3bf802a6435 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -210,16 +210,9 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) */ pmde = READ_ONCE(*pvmw->pmd); - if (pmd_trans_huge(pmde) || is_pmd_migration_entry(pmde)) { + if (pmd_leaf(pmde) || is_pmd_migration_entry(pmde)) { pvmw->ptl = pmd_lock(mm, pvmw->pmd); pmde = *pvmw->pmd; - if (likely(pmd_trans_huge(pmde))) { - if (pvmw->flags & PVMW_MIGRATION) - return not_found(pvmw); - if (!check_pmd(pmd_pfn(pmde), pvmw)) - return not_found(pvmw); - return true; - } if (!pmd_present(pmde)) { swp_entry_t entry; @@ -232,6 +225,13 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) return not_found(pvmw); return true; } + if (likely(pmd_trans_huge(pmde) || pmd_devmap(pmde))) { + if (pvmw->flags & PVMW_MIGRATION) + return not_found(pvmw); + if (!check_pmd(pmd_pfn(pmde), pvmw)) + return not_found(pvmw); + return true; + } /* THP pmd was split under us: handle on pte level */ spin_unlock(pvmw->ptl); pvmw->ptl = NULL; -- 2.11.0