Message ID | 20220109130515.140092-1-sxwjean@me.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 AECA8C433F5 for <linux-mm@archiver.kernel.org>; Sun, 9 Jan 2022 13:05:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0021C6B0072; Sun, 9 Jan 2022 08:05:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ECD356B0073; Sun, 9 Jan 2022 08:05:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6D836B0074; Sun, 9 Jan 2022 08:05:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id C30876B0072 for <linux-mm@kvack.org>; Sun, 9 Jan 2022 08:05:40 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 81E398281C0B for <linux-mm@kvack.org>; Sun, 9 Jan 2022 13:05:40 +0000 (UTC) X-FDA: 79010770440.26.8445FFD Received: from pv50p00im-hyfv10011601.me.com (pv50p00im-hyfv10011601.me.com [17.58.6.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 9BFDF180007 for <linux-mm@kvack.org>; Sun, 9 Jan 2022 13:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1641733538; bh=Pa3d1sSuEEMcS6MIUinhQIpzwlyMz3dkhDvMnS4GXFQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=nRtTdQOYVfyDUjIThebLuxCHdZIcoVH1/lBWyly41egO75IBXQHd2WQ1BGuvtpdZF OcyIoD2jV8E+7mWwvbQa7JZzJFMLvq5tB10GuEv8MBBvrosKFzGXDdYv2Oa9h9T2MY fmhnm2H2wsExB/j4MnhWJuEzCAGKTkK5RLMcaE9kh14xGHrnCWobmnKZVP6wwgmAz/ 1vsFw/XdZeYx6F4Jb2xRUEU6BIOMekA1FaL21J2trQ/NJFlcBD7NOv9hKnHPgmPsKt 5IjBEdym8NMLB6kKgXyDvDyCOYAWvQelq0yRX/570fJxpnNCtPnP/ASit/MgxGOQ00 WXOKGqYl5yfIg== Received: from xiongwei.. (unknown [120.245.2.119]) by pv50p00im-hyfv10011601.me.com (Postfix) with ESMTPSA id D21CD96016F; Sun, 9 Jan 2022 13:05:33 +0000 (UTC) From: sxwjean@me.com To: akpm@linux-foundation.org, david@redhat.com, mhocko@suse.com, dan.j.williams@intel.com, osalvador@suse.de, naoya.horiguchi@nec.com, thunder.leizhen@huawei.com Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Xiongwei Song <sxwjean@gmail.com> Subject: [PATCH 0/2] Add support for getting page info of ZONE_DEVICE by /proc/kpage* Date: Sun, 9 Jan 2022 21:05:13 +0800 Message-Id: <20220109130515.140092-1-sxwjean@me.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425,18.0.790 definitions=2022-01-09_04:2022-01-06,2022-01-09 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=417 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2201090096 X-Rspamd-Queue-Id: 9BFDF180007 X-Stat-Signature: 7w8nj9cs5q57xhofg84d3ai6iu16wqax Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=me.com header.s=1a1hai header.b=nRtTdQOY; dmarc=pass (policy=quarantine) header.from=me.com; spf=pass (imf24.hostedemail.com: domain of sxwjean@me.com designates 17.58.6.43 as permitted sender) smtp.mailfrom=sxwjean@me.com X-Rspamd-Server: rspam02 X-HE-Tag: 1641733539-178595 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
Add support for getting page info of ZONE_DEVICE by /proc/kpage*
|
expand
|
From: Xiongwei Song <sxwjean@gmail.com> Patch 1 is adding pfn_to_devmap_page() function to get page of ZONE_DEVICE by pfn. It checks the sections that is offline but valid or is online but parts of pfns is offline. Then checks if dev_pagemap is valid, if yes, return page pointer. Patch 2 is finishing supporting /proc/kpage* in exposing pages info of ZONE_DEVICE to userspace. The unit test has been done by "page-types -r", which ran in qemu with the below arguments: -object memory-backend-file,id=mem2,share,mem-path=./virtio_pmem.img,size=2G -device virtio-pmem-pci,memdev=mem2,id=nv1 , which is used to emulate pmem device with 2G memory space. As we know, the pages in ZONE_DEVICE are only set PG_reserved flag. So before the serires, run "page-types -r", the result is: flags page-count MB symbolic-flags long-symbolic-flags 0x0000000100000000 24377 95 ___________________________r________________ reserved , which means the only PG_reserved set of pages in system wide have 24377. run "cat /proc/zoneinfo" to get the ZONE_DEVICE info: Node 1, zone Device pages free 0 boost 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 cma 0 protection: (0, 0, 0, 0, 0) After this series, run "page-types -r", the result is: flags page-count MB symbolic-flags long-symbolic-flags 0x0000000100000000 548665 2143 ___________________________r________________ reserved , which means the only PG_reserved set of pages in system wide have 548665. Run "cat /proc/zoneinfo" to get the ZONE_DEVICE info: Node 1, zone Device pages free 0 boost 0 min 0 low 0 high 0 spanned 524288 present 0 managed 0 cma 0 protection: (0, 0, 0, 0, 0) , these added pages number is 524288 in ZONE_DEVICE as spanned field showed. Meanwhile, we can do 548665 - 24377 = 524288 that is increment of the reserved pages, it equals to the spanned field of ZONE_DEVICE. Hence it looks like the patchset works well. Xiongwei Song (2): mm/memremap.c: Add pfn_to_devmap_page() to get page in ZONE_DEVICE proc: Add getting pages info of ZONE_DEVICE support fs/proc/page.c | 35 ++++++++++++++++++++------------- include/linux/memremap.h | 8 ++++++++ mm/memremap.c | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 13 deletions(-)