Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1634465 > unrolled thread
| Started by | Wei Yang <richard.weiyang@gmail.com> |
|---|---|
| First post | 2017-05-02 16:50 +0200 |
| Last post | 2017-05-02 16:50 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH V2 0/3] try to save some memory for kmem_cache in some cases Wei Yang <richard.weiyang@gmail.com> - 2017-05-02 16:50 +0200
[PATCH V2 1/3] mm/slub: pack red_left_pad with another int to save a word Wei Yang <richard.weiyang@gmail.com> - 2017-05-02 16:50 +0200
| From | Wei Yang <richard.weiyang@gmail.com> |
|---|---|
| Date | 2017-05-02 16:50 +0200 |
| Subject | [PATCH V2 0/3] try to save some memory for kmem_cache in some cases |
| Message-ID | <tCHhL-7T4-3@gated-at.bofh.it> |
kmem_cache is a frequently used data in kernel. During the code reading, I
found maybe we could save some space in some cases.
1. On 64bit arch, type int will occupy a word if it doesn't sit well.
2. cpu_slab->partial is just used when CONFIG_SLUB_CPU_PARTIAL is set
3. cpu_partial is just used when CONFIG_SLUB_CPU_PARTIAL is set, while just
save some space on 32bit arch.
v2:
define some macro to make the code more elegant
Wei Yang (3):
mm/slub: pack red_left_pad with another int to save a word
mm/slub: wrap cpu_slab->partial in CONFIG_SLUB_CPU_PARTIAL
mm/slub: wrap kmem_cache->cpu_partial in config
CONFIG_SLUB_CPU_PARTIAL
include/linux/slub_def.h | 34 ++++++++++++++++++-
mm/slub.c | 85 ++++++++++++++++++++++++++----------------------
2 files changed, 80 insertions(+), 39 deletions(-)
--
2.11.0
[toc] | [next] | [standalone]
| From | Wei Yang <richard.weiyang@gmail.com> |
|---|---|
| Date | 2017-05-02 16:50 +0200 |
| Subject | [PATCH V2 1/3] mm/slub: pack red_left_pad with another int to save a word |
| Message-ID | <tCHhM-7T4-17@gated-at.bofh.it> |
| In reply to | #1634465 |
On 64bit arch, struct is 8-bytes aligned, so int will occupy a word if it
doesn't sits well.
This patch pack red_left_pad with reserved to save 8 bytes for struct
kmem_cache on a 64bit arch.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
include/linux/slub_def.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 07ef550c6627..ec13aab32647 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -79,9 +79,9 @@ struct kmem_cache {
int inuse; /* Offset to metadata */
int align; /* Alignment */
int reserved; /* Reserved bytes at the end of slabs */
+ int red_left_pad; /* Left redzone padding size */
const char *name; /* Name (only for display!) */
struct list_head list; /* List of slab caches */
- int red_left_pad; /* Left redzone padding size */
#ifdef CONFIG_SYSFS
struct kobject kobj; /* For sysfs */
#endif
--
2.11.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web