linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "Michał Mirosław" <emmir@google.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	Andrei Vagin <avagin@gmail.com>,
	Danylo Mocherniuk <mdanylo@google.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Christian Brauner <brauner@kernel.org>,
	Peter Xu <peterx@redhat.com>, Yang Shi <shy828301@gmail.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Zach O'Keefe <zokeefe@google.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	kernel@collabora.com,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	David Hildenbrand <david@redhat.com>,
	Peter Enderborg <peter.enderborg@sony.com>,
	"open list : KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list : PROC FILESYSTEM" <linux-fsdevel@vger.kernel.org>,
	"open list : MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH v5 2/3] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs
Date: Tue, 8 Nov 2022 22:51:04 +0500	[thread overview]
Message-ID: <a1155107-fc3a-8098-187d-c2981981ea2f@collabora.com> (raw)
In-Reply-To: <CABb0KFGbhM8V6qeDEzq7Lc_3cseScbK3zvfLndRdJfLstTO=2g@mail.gmail.com>

On 11/8/22 9:00 PM, Michał Mirosław wrote:
>>>> + * @start:             Starting address of the region
>>>> + * @len:               Length of the region (All the pages in this length are included)
>>>> + * @vec:               Address of page_region struct array for output
>>>> + * @vec_len:           Length of the page_region struct array
>>>> + * @max_pages:         Optional max return pages (It must be less than vec_len if specified)
>>> I think we discussed that this is not counting the same things as
>>> vec_len, so there should not be a reference between the two. The limit
>>> is whatever fits under both conditions (IOW: n_vecs <= vec_len &&
>>> (!max_pages || n_pages <= max_pages).
>> In worse case when pages cannot be folded into the page_region, the one
>> page_region may have information of only one page. This is why I've
>> compared them. I want to communicate to the user that if max_pages is
>> used, the vec_len should be of equal or greater size (to cater worse
>> case which can happen at any time). Otherwise in worse case, the api can
>> return without finding the max_pages number of pages. I don't know how
>> should I put this in the comment.
> I'm not sure you need to, as this conclusion follows from the range vs
> page distinction.
> A user who wants to cater for the worst case will provide big-enough
> `vec` array, but another, who might be memory-constrained, could
> instead just retry the call with `start` updated to just after the
> last returned page until the ioctl() returns less ranges than
> `vec_len` allows.
Makes sense. I'll update and send next revision.

Thanks,
Usama
> 
> Best Regards
> Michał Mirosław

  reply	other threads:[~2022-11-08 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 14:53 [PATCH v5 0/3] Implement IOCTL to get and/or the clear info about PTEs Muhammad Usama Anjum
2022-11-03 14:53 ` [PATCH v5 1/3] fs/proc/task_mmu: update functions to clear the soft-dirty PTE bit Muhammad Usama Anjum
2022-11-03 14:53 ` [PATCH v5 2/3] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs Muhammad Usama Anjum
2022-11-07 12:26   ` Michał Mirosław
2022-11-08 14:24     ` Muhammad Usama Anjum
2022-11-08 16:00       ` Michał Mirosław
2022-11-08 17:51         ` Muhammad Usama Anjum [this message]
2022-11-03 14:53 ` [PATCH v5 3/3] selftests: vm: add pagemap ioctl tests Muhammad Usama Anjum
2022-11-03 15:03 ` [PATCH v5 0/3] Implement IOCTL to get and/or the clear info about PTEs 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=a1155107-fc3a-8098-187d-c2981981ea2f@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=emmir@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=kernel@collabora.com \
    --cc=krisman@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=peter.enderborg@sony.com \
    --cc=peterx@redhat.com \
    --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=zokeefe@google.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).