From: Kassey Li <quic_yingangl@quicinc.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, <vbabka@kernel.org>,
"Minchan Kim" <minchan@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
<linux-kernel@vger.kernel.org>, Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH v3] mm/page_owner.c: add llseek for page_owner
Date: Tue, 2 Aug 2022 09:08:36 +0800 [thread overview]
Message-ID: <01b70c1c-b274-7e8f-cdfd-cea020f7279b@quicinc.com> (raw)
In-Reply-To: <CAFqt6zaAFONhDtWcwBbTVM5LkT4v0uM0wLiAnVGpzNydHp_S0Q@mail.gmail.com>
On 7/30/2022 10:28 AM, Souptick Joarder wrote:
> On Fri, Jul 29, 2022 at 6:19 AM Kassey Li <quic_yingangl@quicinc.com> wrote:
>>
>> There is usage to dump a given cma region page_owner
>> instead of all page's.
>>
>> This change allows to specify a ppos as start_pfn
>> by fseek.
>>
>> Any invalid ppos will be skipped, so it did not
>> broken the origin dump feature.
>>
>
> I think a Suggested-by tag needs to be added.
re-send it again. please help to review, thanks.
>
>
>> Signed-off-by: Kassey Li <quic_yingangl@quicinc.com>
>> ---
>> mm/page_owner.c | 20 ++++++++++++++++++--
>> 1 file changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/page_owner.c b/mm/page_owner.c
>> index e4c6f3f1695b..231b1877af99 100644
>> --- a/mm/page_owner.c
>> +++ b/mm/page_owner.c
>> @@ -497,8 +497,8 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>> return -EINVAL;
>>
>> page = NULL;
>> - pfn = min_low_pfn + *ppos;
>>
>> + pfn = *ppos;
>> /* Find a valid PFN or the start of a MAX_ORDER_NR_PAGES area */
>> while (!pfn_valid(pfn) && (pfn & (MAX_ORDER_NR_PAGES - 1)) != 0)
>> pfn++;
>> @@ -561,7 +561,7 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>> continue;
>>
>> /* Record the next PFN to read in the file offset */
>> - *ppos = (pfn - min_low_pfn) + 1;
>> + *ppos = pfn + 1;
>>
>> return print_page_owner(buf, count, pfn, page,
>> page_owner, handle);
>> @@ -570,6 +570,21 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>> return 0;
>> }
>>
>> +static loff_t llseek_page_owner(struct file *file, loff_t offset, int whence)
>> +{
>> + loff_t retval = 0;
>> + switch (whence) {
>> + case SEEK_CUR:
>> + case SEEK_SET:
>> + file->f_pos = offset;
>> + break;
>> + default:
>> + retval = -ENXIO;
>> + }
>> +
>> + return retval;
>> +}
>> +
>> static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
>> {
>> unsigned long pfn = zone->zone_start_pfn;
>> @@ -660,6 +675,7 @@ static void init_early_allocated_pages(void)
>>
>> static const struct file_operations proc_page_owner_operations = {
>> .read = read_page_owner,
>> + .llseek = llseek_page_owner,
>> };
>>
>> static int __init pageowner_init(void)
>> --
>> 2.17.1
>>
>>
next prev parent reply other threads:[~2022-08-02 1:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 0:49 Kassey Li
2022-07-30 2:28 ` Souptick Joarder
2022-08-02 1:08 ` Kassey Li [this message]
2022-08-02 1:06 Kassey Li
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=01b70c1c-b274-7e8f-cdfd-cea020f7279b@quicinc.com \
--to=quic_yingangl@quicinc.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=jrdr.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=vbabka@kernel.org \
/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