linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Muhammad Usama Anjum" <usama.anjum@collabora.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Michał Mirosław" <emmir@google.com>,
	"Andrei Vagin" <avagin@gmail.com>,
	"Danylo Mocherniuk" <mdanylo@google.com>,
	"Paul Gofman" <pgofman@codeweavers.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Shuah Khan" <shuah@kernel.org>,
	"Christian Brauner" <brauner@kernel.org>,
	"Yang Shi" <shy828301@gmail.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	"Yun Zhou" <yun.zhou@windriver.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Alex Sierra" <alex.sierra@amd.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Pasha Tatashin" <pasha.tatashin@soleen.com>,
	"Axel Rasmussen" <axelrasmussen@google.com>,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	"Dan Williams" <dan.j.williams@intel.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	"Greg KH" <gregkh@linuxfoundation.org>,
	kernel@collabora.com, "Cyrill Gorcunov" <gorcunov@gmail.com>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Nadav Amit" <namit@vmware.com>,
	"David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v32 2/6] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs
Date: Mon, 21 Aug 2023 19:11:15 +0500	[thread overview]
Message-ID: <35fe8ddc-cbf3-403c-a40a-2e7b6842ec98@collabora.com> (raw)
In-Reply-To: <ZOAVEFniF/dm+mre@qmqm.qmqm.pl>

On 8/19/23 6:04 AM, Michał Mirosław wrote:
> On Wed, Aug 16, 2023 at 04:30:45PM +0500, Muhammad Usama Anjum wrote:
>> The PAGEMAP_SCAN IOCTL on the pagemap file can be used to get or optionally
>> clear the info about page table entries.
> [...]
>> --- a/fs/proc/task_mmu.c
>> +++ b/fs/proc/task_mmu.c
> [...]
>> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>> +static unsigned long pagemap_thp_category(pmd_t pmd)
>> +{
>> +	unsigned long categories = PAGE_IS_HUGE;
>> +
>> +	/*
>> +	 * THPs don't support file-backed memory. So PAGE_IS_FILE
>> +	 * is not checked here.
>> +	 */
> 
> It seems that we can have THP for files: ref. recent LKML thread [1].
> 
> [1] https://lkml.org/lkml/2023/8/16/1212
I didn't know about this. It seems like khugepaged can create file THPs.
Not sure if there is direct way to create file backed THPs. Maybe they'll
add this support after adding writing support to these file backed THPs.
READ_ONLY_THP_FOR_FS mentions this.

I can add a few lines of code for this here.

> 
>> +	if (pmd_present(pmd)) {
>> +		categories |= PAGE_IS_PRESENT;
>> +		if (!pmd_uffd_wp(pmd))
>> +			categories |= PAGE_IS_WRITTEN;
>> +		if (is_zero_pfn(pmd_pfn(pmd)))
>> +			categories |= PAGE_IS_PFNZERO;
>> +	} else if (is_swap_pmd(pmd)) {
>> +		categories |= PAGE_IS_SWAPPED;
>> +		if (!pmd_swp_uffd_wp(pmd))
>> +			categories |= PAGE_IS_WRITTEN;
>> +	}
>> +
>> +	return categories;
>> +}
> 
> Best Regards
> Michał Mirosław

-- 
BR,
Muhammad Usama Anjum


  reply	other threads:[~2023-08-21 14:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 11:30 [PATCH v32 0/6] Implement IOCTL to get and optionally clear info about PTEs Muhammad Usama Anjum
2023-08-16 11:30 ` [PATCH v32 1/6] userfaultfd: UFFD_FEATURE_WP_ASYNC Muhammad Usama Anjum
2023-08-16 11:30 ` [PATCH v32 2/6] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs Muhammad Usama Anjum
2023-08-18  7:16   ` kernel test robot
2023-08-18  9:55     ` Muhammad Usama Anjum
2023-08-18 12:35       ` Philip Li
2023-08-19  1:04   ` Michał Mirosław
2023-08-21 14:11     ` Muhammad Usama Anjum [this message]
2023-08-16 11:30 ` [PATCH v32 4/6] tools headers UAPI: Update linux/fs.h with the kernel sources Muhammad Usama Anjum
2023-08-16 11:30 ` [PATCH v32 5/6] mm/pagemap: add documentation of PAGEMAP_SCAN IOCTL Muhammad Usama Anjum
2023-08-16 11:30 ` [PATCH v32 6/6] selftests: mm: add pagemap ioctl tests Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35fe8ddc-cbf3-403c-a40a-2e7b6842ec98@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.sierra@amd.com \
    --cc=avagin@gmail.com \
    --cc=axelrasmussen@google.com \
    --cc=brauner@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=emmir@google.com \
    --cc=gorcunov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mdanylo@google.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=namit@vmware.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterx@redhat.com \
    --cc=pgofman@codeweavers.com \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=shy828301@gmail.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=yun.zhou@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).