mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 19:15:14 +00:00
mm/util.c: reduce mem_dump_obj() object size
Simplify the code by using a temporary and reduce the object size by using a single call to pr_cont(). Reverse a test and unindent a block too. $ size mm/util.o* (defconfig x86-64) text data bss dec hex filename 7419 372 40 7831 1e97 mm/util.o.new 7477 372 40 7889 1ed1 mm/util.o.old Link: https://lkml.kernel.org/r/a6e105886338f68afd35f7a13d73bcf06b0cc732.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e8003bf66a
commit
2521781c1e
1 changed files with 14 additions and 10 deletions
24
mm/util.c
24
mm/util.c
|
@ -987,22 +987,26 @@ int __weak memcmp_pages(struct page *page1, struct page *page2)
|
||||||
*/
|
*/
|
||||||
void mem_dump_obj(void *object)
|
void mem_dump_obj(void *object)
|
||||||
{
|
{
|
||||||
|
const char *type;
|
||||||
|
|
||||||
if (kmem_valid_obj(object)) {
|
if (kmem_valid_obj(object)) {
|
||||||
kmem_dump_obj(object);
|
kmem_dump_obj(object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmalloc_dump_obj(object))
|
if (vmalloc_dump_obj(object))
|
||||||
return;
|
return;
|
||||||
if (!virt_addr_valid(object)) {
|
|
||||||
if (object == NULL)
|
if (virt_addr_valid(object))
|
||||||
pr_cont(" NULL pointer.\n");
|
type = "non-slab/vmalloc memory";
|
||||||
else if (object == ZERO_SIZE_PTR)
|
else if (object == NULL)
|
||||||
pr_cont(" zero-size pointer.\n");
|
type = "NULL pointer";
|
||||||
else
|
else if (object == ZERO_SIZE_PTR)
|
||||||
pr_cont(" non-paged memory.\n");
|
type = "zero-size pointer";
|
||||||
return;
|
else
|
||||||
}
|
type = "non-paged memory";
|
||||||
pr_cont(" non-slab/vmalloc memory.\n");
|
|
||||||
|
pr_cont(" %s\n", type);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mem_dump_obj);
|
EXPORT_SYMBOL_GPL(mem_dump_obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue