All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages
@ 2018-11-02 12:00 Balbir Singh
  2018-11-02 12:32 ` Michal Hocko
  2018-11-06 23:32 ` Naoya Horiguchi
  0 siblings, 2 replies; 3+ messages in thread
From: Balbir Singh @ 2018-11-02 12:00 UTC (permalink / raw)
  To: akpm; +Cc: mhocko, linux-mm, linux-kernel, Balbir Singh

In hot remove, we try to clear poisoned pages, but
a small optimization to check if num_poisoned_pages
is 0 helps remove the iteration through nr_pages.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 mm/sparse.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mm/sparse.c b/mm/sparse.c
index 33307fc05c4d..16219c7ddb5f 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -724,6 +724,16 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
 	if (!memmap)
 		return;
 
+	/*
+	 * A further optimization is to have per section
+	 * ref counted num_poisoned_pages, but that is going
+	 * to need more space per memmap, for now just do
+	 * a quick global check, this should speed up this
+	 * routine in the absence of bad pages.
+	 */
+	if (atomic_long_read(&num_poisoned_pages) == 0)
+		return;
+
 	for (i = 0; i < nr_pages; i++) {
 		if (PageHWPoison(&memmap[i])) {
 			atomic_long_sub(1, &num_poisoned_pages);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages
  2018-11-02 12:00 [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages Balbir Singh
@ 2018-11-02 12:32 ` Michal Hocko
  2018-11-06 23:32 ` Naoya Horiguchi
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-11-02 12:32 UTC (permalink / raw)
  To: Balbir Singh; +Cc: akpm, linux-mm, linux-kernel

On Fri 02-11-18 23:00:01, Balbir Singh wrote:
> In hot remove, we try to clear poisoned pages, but
> a small optimization to check if num_poisoned_pages
> is 0 helps remove the iteration through nr_pages.
> 
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>

Makes sense to me. It would be great to actually have some number but
the optimization for the normal case is quite obvious.

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/sparse.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 33307fc05c4d..16219c7ddb5f 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -724,6 +724,16 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>  	if (!memmap)
>  		return;
>  
> +	/*
> +	 * A further optimization is to have per section
> +	 * ref counted num_poisoned_pages, but that is going
> +	 * to need more space per memmap, for now just do
> +	 * a quick global check, this should speed up this
> +	 * routine in the absence of bad pages.
> +	 */
> +	if (atomic_long_read(&num_poisoned_pages) == 0)
> +		return;
> +
>  	for (i = 0; i < nr_pages; i++) {
>  		if (PageHWPoison(&memmap[i])) {
>  			atomic_long_sub(1, &num_poisoned_pages);
> -- 
> 2.17.1
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages
  2018-11-02 12:00 [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages Balbir Singh
  2018-11-02 12:32 ` Michal Hocko
@ 2018-11-06 23:32 ` Naoya Horiguchi
  1 sibling, 0 replies; 3+ messages in thread
From: Naoya Horiguchi @ 2018-11-06 23:32 UTC (permalink / raw)
  To: Balbir Singh; +Cc: akpm, mhocko, linux-mm, linux-kernel

On Fri, Nov 02, 2018 at 11:00:01PM +1100, Balbir Singh wrote:
> In hot remove, we try to clear poisoned pages, but
> a small optimization to check if num_poisoned_pages
> is 0 helps remove the iteration through nr_pages.
> 
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>

Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-06 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 12:00 [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages Balbir Singh
2018-11-02 12:32 ` Michal Hocko
2018-11-06 23:32 ` Naoya Horiguchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.