* + mm-reduce-mem_dump_obj-object-size.patch added to -mm tree
@ 2021-03-08 22:41 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-03-08 22:41 UTC (permalink / raw)
To: akpm, joe, mm-commits
The patch titled
Subject: mm/util.c: reduce mem_dump_obj() object size
has been added to the -mm tree. Its filename is
mm-reduce-mem_dump_obj-object-size.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-reduce-mem_dump_obj-object-size.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-reduce-mem_dump_obj-object-size.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: 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>
---
mm/util.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
--- a/mm/util.c~mm-reduce-mem_dump_obj-object-size
+++ a/mm/util.c
@@ -996,20 +996,24 @@ int __weak memcmp_pages(struct page *pag
*/
void mem_dump_obj(void *object)
{
+ const char *type;
+
if (kmem_valid_obj(object)) {
kmem_dump_obj(object);
return;
}
+
if (vmalloc_dump_obj(object))
return;
- if (!virt_addr_valid(object)) {
- if (object == NULL)
- pr_cont(" NULL pointer.\n");
- else if (object == ZERO_SIZE_PTR)
- pr_cont(" zero-size pointer.\n");
- else
- pr_cont(" non-paged memory.\n");
- return;
- }
- pr_cont(" non-slab/vmalloc memory.\n");
+
+ if (virt_addr_valid(object))
+ type = "non-slab/vmalloc memory";
+ else if (object == NULL)
+ type = "NULL pointer";
+ else if (object == ZERO_SIZE_PTR)
+ type = "zero-size pointer";
+ else
+ type = "non-paged memory";
+
+ pr_cont(" %s\n", type);
}
_
Patches currently in -mm which might be from joe@perches.com are
mm-reduce-mem_dump_obj-object-size.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-08 22:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 22:41 + mm-reduce-mem_dump_obj-object-size.patch added to -mm tree akpm
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.