From patchwork Thu Feb 23 02:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Sun X-Patchwork-Id: 13149788 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 4DB80C61DA4 for ; Thu, 23 Feb 2023 02:43:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ADA36B0072; Wed, 22 Feb 2023 21:43:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65E3D6B0073; Wed, 22 Feb 2023 21:43:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 525746B0074; Wed, 22 Feb 2023 21:43:44 -0500 (EST) 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 40B476B0072 for ; Wed, 22 Feb 2023 21:43:44 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1937A80A90 for ; Thu, 23 Feb 2023 02:43:44 +0000 (UTC) X-FDA: 80497011168.28.0770378 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf17.hostedemail.com (Postfix) with ESMTP id 56CA940003 for ; Thu, 23 Feb 2023 02:43:41 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of sk.alvin.x@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=sk.alvin.x@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677120222; 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:references; bh=+RRSa5splVjb43STyERCx9WqlUztd7VM3FAvVjySaRc=; b=6X5G/0OtPH/tQERM3etPkvPV9sW6D3qWzjONHK6KEWvBoFgCYpXt/8as3R2gCPPltfZ0h0 DyuY20Ww9WMEHTYIV+Jtx3g3XJwJcZZT8dkBRm9kZ7CFqiXEAdQRRO6r2eqUAfNvpMHT82 J323mmMCjOtNkzpLmPLf0vmBHVC12bw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of sk.alvin.x@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=sk.alvin.x@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677120222; a=rsa-sha256; cv=none; b=SnpIk8yqoAeIkEFpRZnndsFRenAG1JdCWfVlqLsx/AQc5Bp4YpnzM455L4DO0Ul8HAda7Q PSlVBEn8gof5MKr0zPMdhBRWX271U3iBNY5VhiAmMnWdtlTcw5hdC3rGtJ3EtwkiM2pMDy sCPxrhnlHBBK3enNX5VdN62YHyGRDWI= Received: by mail-pl1-f179.google.com with SMTP id s5so11159471plg.0 for ; Wed, 22 Feb 2023 18:43:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+RRSa5splVjb43STyERCx9WqlUztd7VM3FAvVjySaRc=; b=S0Ll/qBeTMa8ci/z8Sj1Zr+xitiM0HL1EenVn3Qv+Y4gQSzMi/2WWg53aA3SVpFX6k hlZNiDxWPklgBthjBIs9ujQWZMqSjaIVOz+fUpUI14p+WEHAg+5rwXcKO9ISguFs9Sqf oqz67VukqfgU/Fz/63H7wSYs9/C+YzoCyYFMm1vDnCXkTApSUW0Hxneadcs4mYrH+YHE DGkhCY3E78vJ905+1apTU1QX/7lggLcLFHHEOPA+nSr8nTwtJoY/Wj4wDy6D6qXjhDqd co5SjNFeTLd+Ni3rLTK3VRe5WQxgaIlRXxrIlHw42rNAqJFET0HjGEIYK31p1aXmwpCl NfvA== X-Gm-Message-State: AO0yUKWHT6LZAKO6GdpV9pOkk4F7wzw9QCIoR0wcSODUgsF9RghgHcDv kzMPdH/m10c6zUfh6cfgqQU= X-Google-Smtp-Source: AK7set8I3NBhaf91prdHzskrOHBW/DbdHgpSePrMBVWKWgirrHeCstQuH88WWE1bmmzjy00B8g5vSw== X-Received: by 2002:a17:903:28c6:b0:19a:a43c:41b7 with SMTP id kv6-20020a17090328c600b0019aa43c41b7mr9454095plb.21.1677120220145; Wed, 22 Feb 2023 18:43:40 -0800 (PST) Received: from localhost.localdomain (144.34.241.68.16clouds.com. [144.34.241.68]) by smtp.gmail.com with ESMTPSA id je15-20020a170903264f00b00199025284b3sm12512760plb.151.2023.02.22.18.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 18:43:39 -0800 (PST) From: Ke Sun To: Andrew Morton , Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ke Sun Subject: [RESEND PATCH RFC] mm: pagemap: add vma(VM_PFNMAP) support in pagemap_pte_hole() Date: Thu, 23 Feb 2023 10:43:32 +0800 Message-Id: <20230223024332.1337578-1-sunke@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 56CA940003 X-Stat-Signature: n3tjupwf5q34fre7afbj18zbo37pqmdy X-HE-Tag: 1677120221-439656 X-HE-Meta: U2FsdGVkX19/fnMd7ByKAaYhjTM4fqyzeBxAaBSABX8HAfxMpPGeqPWZgh8o+nWoUO0VRVIMUtrAXz9x/MOviRv4EQkJ/D7py5h0Uwk8/zGObmX6JKtCd/RG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jm6/VAA0Ygs+zjn0Qgi7TofzeZoZldGlIhfkJeOWPAi7BZBgCH357vJrXyCwdcDWz6p+GPqBF++a1hqxEBNe5q437hwI3gMtSh6nYNNw4jbF9NmZhnaQNezS3ySXSz1DhWwq90MNXEsMFIkWgf7GSgXaRbKIiJJ2RapudX77QQoJWz4DaB0Ww1x7CCrDblumCY4ObPhZQtaOX4C2Rzp8YqSuO0d7XIzOtcz686d0xx/hdjuw8YsXiuwGQ4gl+P1y8OZV+Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000540, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: pagemap currently does not support vma(FIXMAP), add support in pagemap_pte_hole(). Signed-off-by: Ke Sun --- fs/proc/task_mmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index af1c49ae11b1..297c7b9dc630 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1400,6 +1400,11 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end, if (vma->vm_flags & VM_SOFTDIRTY) pme = make_pme(0, PM_SOFT_DIRTY); for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) { + if ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff) { + unsigned long pgoff = (addr - vma->vm_start) >> PAGE_SHIFT; + + pme = make_pme(vma->vm_pgoff + pgoff, PM_PRESENT); + } err = add_to_pagemap(addr, &pme, pm); if (err) goto out;