public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Question About Functions "__free_pages_check" and "check_new_page" in page_alloc.c
       [not found] <7374bd2e.da35.154b9cda7d2.Coremail.wang_xiaoq@126.com>
@ 2016-05-16 15:16 ` Michal Hocko
       [not found]   ` <5877fe6c.1e45.154bc401c81.Coremail.wang_xiaoq@126.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Hocko @ 2016-05-16 15:16 UTC (permalink / raw)
  To: Wang Xiaoqiang; +Cc: vbabka, n-horiguchi, linux-kernel, linux-mm

On Mon 16-05-16 21:42:23, Wang Xiaoqiang wrote:
> Hi all,
> 
>     I am really confused about these two functions. The following code snippet:
> 
> if(unlikely(atomic_read(&page->_mapcount) != -1))
> 		bad_reason ="nonzero mapcount";if(unlikely(page->mapping != NULL))
> 		bad_reason ="non-NULL mapping";if(unlikely(page_ref_count(page) !=0))
> 		bad_reason ="nonzero _count";
>         ...
> Wouldn't the previous value of "bad_reason" be overwritten by 
> the later? Hope to receive from you.

yes it would. Why that would matter. The checks should be in an order
which could give us a more specific reason with later checks. bad_page()
will then print more detailed information.
-- 
Michal Hocko
SUSE Labs

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

* Re: Question About Functions "__free_pages_check" and "check_new_page" in page_alloc.c
       [not found]   ` <5877fe6c.1e45.154bc401c81.Coremail.wang_xiaoq@126.com>
@ 2016-05-17  5:14     ` Vlastimil Babka
  0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2016-05-17  5:14 UTC (permalink / raw)
  To: Wang Xiaoqiang, Michal Hocko, n-horiguchi, linux-kernel, linux-mm

On 05/17/2016 03:06 AM, Wang Xiaoqiang wrote:
>>yes it would. Why that would matter. The checks should be in an order
>>which could give us a more specific reason with later checks. bad_page()
> 
> I see, you mean the later "bad_reason" is the superset of the previous one.

Not exactly. It's not possible to sort all the reasons like that. But as
Michal said, bad_page() will print all the relevant info so you can
reconstruct all reasons from it. The bad_reason text is mostly a hint
what to check first.

>>will then print more detailed information.
>>--
>>Michal Hocko
>>SUSE Labs
> 
> thank you, Michal.
> 
> 
>  
> 

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

end of thread, other threads:[~2016-05-17  5:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7374bd2e.da35.154b9cda7d2.Coremail.wang_xiaoq@126.com>
2016-05-16 15:16 ` Question About Functions "__free_pages_check" and "check_new_page" in page_alloc.c Michal Hocko
     [not found]   ` <5877fe6c.1e45.154bc401c81.Coremail.wang_xiaoq@126.com>
2016-05-17  5:14     ` Vlastimil Babka

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