From: "Huang, Ying" <ying.huang@intel.com>
To: <alexlzhu@fb.com>
Cc: <linux-mm@kvack.org>, <kernel-team@fb.com>,
<willy@infradead.org>, <riel@surriel.com>, <hannes@cmpxchg.org>
Subject: Re: [PATCH v4 1/3] mm: add thp_utilization metrics to debugfs
Date: Tue, 25 Oct 2022 11:21:33 +0800 [thread overview]
Message-ID: <87mt9klhaa.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <6ee57dc7d2eadaee2816ef19fdbdc54ab356d5fb.1666150565.git.alexlzhu@fb.com> (alexlzhu@fb.com's message of "Tue, 18 Oct 2022 20:42:18 -0700")
<alexlzhu@fb.com> writes:
[snip]
> +static void thp_util_scan(unsigned long pfn_end)
> +{
> + struct page *page = NULL;
> + int bucket, current_pfn, num_utilized_pages;
> + int i;
> + /*
> + * Scan through each memory zone in chunks of THP_UTIL_SCAN_SIZE
> + * PFNs every second looking for anonymous THPs.
> + */
> + for (i = 0; i < THP_UTIL_SCAN_SIZE; i++) {
> + current_pfn = thp_scan.pfn;
> + thp_scan.pfn += HPAGE_PMD_NR;
> + if (current_pfn >= pfn_end)
> + return;
> +
> + page = pfn_to_online_page(current_pfn);
> + if (!page)
> + continue;
If my understanding were correct, the page may be offlined during
pfn_to_online_page() and the following code. So we need to call
get/put_online_mems().
If my understanding were incorrect, can anyone teach me on this?
> +
> + num_utilized_pages = thp_number_utilized_pages(page_folio(page));
> + bucket = thp_utilization_bucket(num_utilized_pages);
> + if (bucket < 0)
> + continue;
> +
> + thp_scan.buckets[bucket].nr_thps++;
> + thp_scan.buckets[bucket].nr_zero_pages += (HPAGE_PMD_NR - num_utilized_pages);
> + }
> +}
> +
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2022-10-25 3:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 3:42 [PATCH v4 0/3] THP Shrinker alexlzhu
2022-10-19 3:42 ` [PATCH v4 1/3] mm: add thp_utilization metrics to debugfs alexlzhu
2022-10-25 3:21 ` Huang, Ying [this message]
2022-10-19 3:42 ` [PATCH v4 2/3] mm: changes to split_huge_page() to free zero filled tail pages alexlzhu
2022-10-19 5:12 ` Yu Zhao
2022-10-19 18:48 ` Alex Zhu (Kernel)
2022-10-25 6:21 ` Ning Zhang
2022-10-26 19:43 ` Alex Zhu (Kernel)
2022-10-20 21:57 ` kernel test robot
2022-10-19 3:42 ` [PATCH v4 3/3] mm: THP low utilization shrinker alexlzhu
2022-10-19 15:16 ` kernel test robot
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=87mt9klhaa.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=alexlzhu@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-mm@kvack.org \
--cc=riel@surriel.com \
--cc=willy@infradead.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