linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC] mm: memcontrol: fix a unbalance uncharged count
@ 2016-05-31  9:38 roy.qing.li
  2016-05-31  9:50 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2016-05-31  9:38 UTC (permalink / raw)
  To: cgroups, linux-mm; +Cc: hannes, mhocko, vdavydov

From: Li RongQing <roy.qing.li@gmail.com>

I see the number of page of hpage_nr_pages(page) is charged if page is
transparent huge or hugetlbfs pages; but when uncharge a huge page,
(1<<compound_order) page is uncharged, and maybe hpage_nr_pages(page) is
not same as 1<<compound_order.

And remove VM_BUG_ON_PAGE(!PageTransHuge(page), page); since
PageTransHuge(page) always is true, when this VM_BUG_ON_PAGE is called.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 mm/memcontrol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 12aaadd..28c0137 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5453,8 +5453,7 @@ static void uncharge_list(struct list_head *page_list)
 		}
 
 		if (PageTransHuge(page)) {
-			nr_pages <<= compound_order(page);
-			VM_BUG_ON_PAGE(!PageTransHuge(page), page);
+			nr_pages = hpage_nr_pages(page);
 			nr_huge += nr_pages;
 		}
 
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH][RFC] mm: memcontrol: fix a unbalance uncharged count
  2016-05-31  9:38 [PATCH][RFC] mm: memcontrol: fix a unbalance uncharged count roy.qing.li
@ 2016-05-31  9:50 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2016-05-31  9:50 UTC (permalink / raw)
  To: roy.qing.li; +Cc: cgroups, linux-mm, hannes, vdavydov

On Tue 31-05-16 17:38:32, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> I see the number of page of hpage_nr_pages(page) is charged if page is
> transparent huge or hugetlbfs pages; but when uncharge a huge page,

hugetlb pages do not get charged to the memcg. They have their own
hugetlbfscg controller.

> (1<<compound_order) page is uncharged, and maybe hpage_nr_pages(page) is
> not same as 1<<compound_order.

This should never happen. So this is not a fix. I guess it would a clean
up though.

> And remove VM_BUG_ON_PAGE(!PageTransHuge(page), page); since
> PageTransHuge(page) always is true, when this VM_BUG_ON_PAGE is called.

I guess we can drop this BUG_ON because nobody should be be seeing the
page at this stage so we cannot race with a THP split up. But I would
really have to look closer. This would be a patch on its own with the
full explanation though, IMHO.

> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  mm/memcontrol.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 12aaadd..28c0137 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5453,8 +5453,7 @@ static void uncharge_list(struct list_head *page_list)
>  		}
>  
>  		if (PageTransHuge(page)) {
> -			nr_pages <<= compound_order(page);
> -			VM_BUG_ON_PAGE(!PageTransHuge(page), page);
> +			nr_pages = hpage_nr_pages(page);
>  			nr_huge += nr_pages;
>  		}
>  
> -- 
> 2.1.4

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-05-31  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31  9:38 [PATCH][RFC] mm: memcontrol: fix a unbalance uncharged count roy.qing.li
2016-05-31  9:50 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox