Re: [PATCH 05/11] mm: debug: dump page into a string rather than directly on screen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 1 Jul 2015, Sasha Levin wrote:

> Since we'd BUG at VM_BUG_ON(), this would be something closer to:
> 
> 	if (unlikely(compound_head(page) != head)) {
> 		dump_page(page);
> 		dump_page(head);
> 		VM_BUG_ON(1);
> 	}
> 

I was thinking closer to

	if (VM_WARN_ON(compound_head(page) != head)) {
		...
		BUG();
	}

so we prefix all output with the typical warning diagnostics, emit 
whatever page, vma, etc output we want, and then finally die.  The final 
BUG() here would have to be replaced by something that suppresses the 
repeated output.

If it's really just a warning, then no BUG() needed.

> But my point here was that while one *could* do it that way, no one does because
> it's not intuitive. We both agree that in the example above it would be useful to
> see both 'page' and 'head', and yet the code that was written didn't dump any of
> them. Why? No one wants to write debug code unless it's easy and short.
> 

pr_alert("%pZp %pZv", page, vma) isn't shorter than dump_page(page); 
dump_vma(vma), but it would be a line shorter.  I'm not sure that the 
former is easier, though, and it prevents us from ever expanding dump_*() 
functions for conditional output.

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]