Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'slab-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/christoph/vm

* 'slab-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/christoph/vm:
slub: fix possible NULL pointer dereference
slub: Add kmalloc_large_node() to support kmalloc_node fallback
slub: look up object from the freelist once
slub: Fix up comments
slub: Rearrange #ifdef CONFIG_SLUB_DEBUG in calculate_sizes()
slub: Remove BUG_ON() from ksize and omit checks for !SLUB_DEBUG
slub: Use the objsize from the kmem_cache_cpu structure
slub: Remove useless checks in alloc_debug_processing
slub: Remove objsize check in kmem_cache_flags()
slub: rename slab_objects to show_slab_objects
Revert "unique end pointer" patch
slab: avoid double initialization & do initialization in 1 place

+92 -121
+1 -4
include/linux/mm_types.h
··· 64 64 #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 65 65 spinlock_t ptl; 66 66 #endif 67 - struct { 68 - struct kmem_cache *slab; /* SLUB: Pointer to slab */ 69 - void *end; /* SLUB: end marker */ 70 - }; 67 + struct kmem_cache *slab; /* SLUB: Pointer to slab */ 71 68 struct page *first_page; /* Compound tail pages */ 72 69 }; 73 70 union {
+2 -2
include/linux/slub_def.h
··· 61 61 int size; /* The size of an object including meta data */ 62 62 int objsize; /* The size of an object without meta data */ 63 63 int offset; /* Free pointer offset. */ 64 - int order; 64 + int order; /* Current preferred allocation order */ 65 65 66 66 /* 67 67 * Avoid an extra cache line for UP, SMP and for the node local to ··· 138 138 if (size <= 512) return 9; 139 139 if (size <= 1024) return 10; 140 140 if (size <= 2 * 1024) return 11; 141 + if (size <= 4 * 1024) return 12; 141 142 /* 142 143 * The following is only needed to support architectures with a larger page 143 144 * size than 4k. 144 145 */ 145 - if (size <= 4 * 1024) return 12; 146 146 if (size <= 8 * 1024) return 13; 147 147 if (size <= 16 * 1024) return 14; 148 148 if (size <= 32 * 1024) return 15;
+89 -115
mm/slub.c
··· 291 291 #endif 292 292 } 293 293 294 - /* 295 - * The end pointer in a slab is special. It points to the first object in the 296 - * slab but has bit 0 set to mark it. 297 - * 298 - * Note that SLUB relies on page_mapping returning NULL for pages with bit 0 299 - * in the mapping set. 300 - */ 301 - static inline int is_end(void *addr) 302 - { 303 - return (unsigned long)addr & PAGE_MAPPING_ANON; 304 - } 305 - 306 - static void *slab_address(struct page *page) 307 - { 308 - return page->end - PAGE_MAPPING_ANON; 309 - } 310 - 294 + /* Verify that a pointer has an address that is valid within a slab page */ 311 295 static inline int check_valid_pointer(struct kmem_cache *s, 312 296 struct page *page, const void *object) 313 297 { 314 298 void *base; 315 299 316 - if (object == page->end) 300 + if (!object) 317 301 return 1; 318 302 319 - base = slab_address(page); 303 + base = page_address(page); 320 304 if (object < base || object >= base + s->objects * s->size || 321 305 (object - base) % s->size) { 322 306 return 0; ··· 333 349 334 350 /* Scan freelist */ 335 351 #define for_each_free_object(__p, __s, __free) \ 336 - for (__p = (__free); (__p) != page->end; __p = get_freepointer((__s),\ 337 - __p)) 352 + for (__p = (__free); __p; __p = get_freepointer((__s), __p)) 338 353 339 354 /* Determine object index from a given position */ 340 355 static inline int slab_index(void *p, struct kmem_cache *s, void *addr) ··· 485 502 static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) 486 503 { 487 504 unsigned int off; /* Offset of last byte */ 488 - u8 *addr = slab_address(page); 505 + u8 *addr = page_address(page); 489 506 490 507 print_tracking(s, p); 491 508 ··· 620 637 * A. Free pointer (if we cannot overwrite object on free) 621 638 * B. Tracking data for SLAB_STORE_USER 622 639 * C. Padding to reach required alignment boundary or at mininum 623 - * one word if debuggin is on to be able to detect writes 640 + * one word if debugging is on to be able to detect writes 624 641 * before the word boundary. 625 642 * 626 643 * Padding is done using 0x5a (POISON_INUSE) ··· 663 680 if (!(s->flags & SLAB_POISON)) 664 681 return 1; 665 682 666 - start = slab_address(page); 683 + start = page_address(page); 667 684 end = start + (PAGE_SIZE << s->order); 668 685 length = s->objects * s->size; 669 686 remainder = end - (start + length); ··· 731 748 * of the free objects in this slab. May cause 732 749 * another error because the object count is now wrong. 733 750 */ 734 - set_freepointer(s, p, page->end); 751 + set_freepointer(s, p, NULL); 735 752 return 0; 736 753 } 737 754 return 1; ··· 765 782 void *fp = page->freelist; 766 783 void *object = NULL; 767 784 768 - while (fp != page->end && nr <= s->objects) { 785 + while (fp && nr <= s->objects) { 769 786 if (fp == search) 770 787 return 1; 771 788 if (!check_valid_pointer(s, page, fp)) { 772 789 if (object) { 773 790 object_err(s, page, object, 774 791 "Freechain corrupt"); 775 - set_freepointer(s, object, page->end); 792 + set_freepointer(s, object, NULL); 776 793 break; 777 794 } else { 778 795 slab_err(s, page, "Freepointer corrupt"); 779 - page->freelist = page->end; 796 + page->freelist = NULL; 780 797 page->inuse = s->objects; 781 798 slab_fix(s, "Freelist cleared"); 782 799 return 0; ··· 853 870 if (!check_slab(s, page)) 854 871 goto bad; 855 872 856 - if (object && !on_freelist(s, page, object)) { 873 + if (!on_freelist(s, page, object)) { 857 874 object_err(s, page, object, "Object already allocated"); 858 875 goto bad; 859 876 } ··· 863 880 goto bad; 864 881 } 865 882 866 - if (object && !check_object(s, page, object, 0)) 883 + if (!check_object(s, page, object, 0)) 867 884 goto bad; 868 885 869 886 /* Success perform special debug activities for allocs */ ··· 882 899 */ 883 900 slab_fix(s, "Marking all objects used"); 884 901 page->inuse = s->objects; 885 - page->freelist = page->end; 902 + page->freelist = NULL; 886 903 } 887 904 return 0; 888 905 } ··· 922 939 } 923 940 924 941 /* Special debug activities for freeing objects */ 925 - if (!SlabFrozen(page) && page->freelist == page->end) 942 + if (!SlabFrozen(page) && !page->freelist) 926 943 remove_full(s, page); 927 944 if (s->flags & SLAB_STORE_USER) 928 945 set_track(s, object, TRACK_FREE, addr); ··· 998 1015 void (*ctor)(struct kmem_cache *, void *)) 999 1016 { 1000 1017 /* 1001 - * The page->offset field is only 16 bit wide. This is an offset 1002 - * in units of words from the beginning of an object. If the slab 1003 - * size is bigger then we cannot move the free pointer behind the 1004 - * object anymore. 1005 - * 1006 - * On 32 bit platforms the limit is 256k. On 64bit platforms 1007 - * the limit is 512k. 1008 - * 1009 - * Debugging or ctor may create a need to move the free 1010 - * pointer. Fail if this happens. 1018 + * Enable debugging if selected on the kernel commandline. 1011 1019 */ 1012 - if (objsize >= 65535 * sizeof(void *)) { 1013 - BUG_ON(flags & (SLAB_RED_ZONE | SLAB_POISON | 1014 - SLAB_STORE_USER | SLAB_DESTROY_BY_RCU)); 1015 - BUG_ON(ctor); 1016 - } else { 1017 - /* 1018 - * Enable debugging if selected on the kernel commandline. 1019 - */ 1020 - if (slub_debug && (!slub_debug_slabs || 1021 - strncmp(slub_debug_slabs, name, 1022 - strlen(slub_debug_slabs)) == 0)) 1023 - flags |= slub_debug; 1024 - } 1020 + if (slub_debug && (!slub_debug_slabs || 1021 + strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)) == 0)) 1022 + flags |= slub_debug; 1025 1023 1026 1024 return flags; 1027 1025 } ··· 1088 1124 SetSlabDebug(page); 1089 1125 1090 1126 start = page_address(page); 1091 - page->end = start + 1; 1092 1127 1093 1128 if (unlikely(s->flags & SLAB_POISON)) 1094 1129 memset(start, POISON_INUSE, PAGE_SIZE << s->order); ··· 1099 1136 last = p; 1100 1137 } 1101 1138 setup_object(s, page, last); 1102 - set_freepointer(s, last, page->end); 1139 + set_freepointer(s, last, NULL); 1103 1140 1104 1141 page->freelist = start; 1105 1142 page->inuse = 0; ··· 1115 1152 void *p; 1116 1153 1117 1154 slab_pad_check(s, page); 1118 - for_each_object(p, s, slab_address(page)) 1155 + for_each_object(p, s, page_address(page)) 1119 1156 check_object(s, page, p, 0); 1120 1157 ClearSlabDebug(page); 1121 1158 } ··· 1125 1162 NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE, 1126 1163 -pages); 1127 1164 1128 - page->mapping = NULL; 1129 1165 __free_pages(page, s->order); 1130 1166 } 1131 1167 ··· 1269 1307 * may return off node objects because partial slabs are obtained 1270 1308 * from other nodes and filled up. 1271 1309 * 1272 - * If /sys/slab/xx/defrag_ratio is set to 100 (which makes 1310 + * If /sys/kernel/slab/xx/defrag_ratio is set to 100 (which makes 1273 1311 * defrag_ratio = 1000) then every (well almost) allocation will 1274 1312 * first attempt to defrag slab caches on other nodes. This means 1275 1313 * scanning over all nodes to look for partial slabs which may be ··· 1328 1366 ClearSlabFrozen(page); 1329 1367 if (page->inuse) { 1330 1368 1331 - if (page->freelist != page->end) { 1369 + if (page->freelist) { 1332 1370 add_partial(n, page, tail); 1333 1371 stat(c, tail ? DEACTIVATE_TO_TAIL : DEACTIVATE_TO_HEAD); 1334 1372 } else { ··· 1344 1382 * Adding an empty slab to the partial slabs in order 1345 1383 * to avoid page allocator overhead. This slab needs 1346 1384 * to come after the other slabs with objects in 1347 - * order to fill them up. That way the size of the 1348 - * partial list stays small. kmem_cache_shrink can 1349 - * reclaim empty slabs from the partial list. 1385 + * so that the others get filled first. That way the 1386 + * size of the partial list stays small. 1387 + * 1388 + * kmem_cache_shrink can reclaim any empty slabs from the 1389 + * partial list. 1350 1390 */ 1351 1391 add_partial(n, page, 1); 1352 1392 slab_unlock(page); ··· 1371 1407 if (c->freelist) 1372 1408 stat(c, DEACTIVATE_REMOTE_FREES); 1373 1409 /* 1374 - * Merge cpu freelist into freelist. Typically we get here 1410 + * Merge cpu freelist into slab freelist. Typically we get here 1375 1411 * because both freelists are empty. So this is unlikely 1376 1412 * to occur. 1377 - * 1378 - * We need to use _is_end here because deactivate slab may 1379 - * be called for a debug slab. Then c->freelist may contain 1380 - * a dummy pointer. 1381 1413 */ 1382 - while (unlikely(!is_end(c->freelist))) { 1414 + while (unlikely(c->freelist)) { 1383 1415 void **object; 1384 1416 1385 1417 tail = 0; /* Hot objects. Put the slab first */ ··· 1402 1442 1403 1443 /* 1404 1444 * Flush cpu slab. 1445 + * 1405 1446 * Called from IPI handler with interrupts disabled. 1406 1447 */ 1407 1448 static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu) ··· 1461 1500 * rest of the freelist to the lockless freelist. 1462 1501 * 1463 1502 * And if we were unable to get a new slab from the partial slab lists then 1464 - * we need to allocate a new slab. This is slowest path since we may sleep. 1503 + * we need to allocate a new slab. This is the slowest path since it involves 1504 + * a call to the page allocator and the setup of a new slab. 1465 1505 */ 1466 1506 static void *__slab_alloc(struct kmem_cache *s, 1467 1507 gfp_t gfpflags, int node, void *addr, struct kmem_cache_cpu *c) ··· 1476 1514 slab_lock(c->page); 1477 1515 if (unlikely(!node_match(c, node))) 1478 1516 goto another_slab; 1517 + 1479 1518 stat(c, ALLOC_REFILL); 1519 + 1480 1520 load_freelist: 1481 1521 object = c->page->freelist; 1482 - if (unlikely(object == c->page->end)) 1522 + if (unlikely(!object)) 1483 1523 goto another_slab; 1484 1524 if (unlikely(SlabDebug(c->page))) 1485 1525 goto debug; 1486 1526 1487 - object = c->page->freelist; 1488 1527 c->freelist = object[c->offset]; 1489 1528 c->page->inuse = s->objects; 1490 - c->page->freelist = c->page->end; 1529 + c->page->freelist = NULL; 1491 1530 c->node = page_to_nid(c->page); 1492 1531 unlock_out: 1493 1532 slab_unlock(c->page); ··· 1541 1578 1542 1579 return NULL; 1543 1580 debug: 1544 - object = c->page->freelist; 1545 1581 if (!alloc_debug_processing(s, c->page, object, addr)) 1546 1582 goto another_slab; 1547 1583 ··· 1569 1607 1570 1608 local_irq_save(flags); 1571 1609 c = get_cpu_slab(s, smp_processor_id()); 1572 - if (unlikely(is_end(c->freelist) || !node_match(c, node))) 1610 + if (unlikely(!c->freelist || !node_match(c, node))) 1573 1611 1574 1612 object = __slab_alloc(s, gfpflags, node, addr, c); 1575 1613 ··· 1621 1659 1622 1660 if (unlikely(SlabDebug(page))) 1623 1661 goto debug; 1662 + 1624 1663 checks_ok: 1625 1664 prior = object[offset] = page->freelist; 1626 1665 page->freelist = object; ··· 1636 1673 goto slab_empty; 1637 1674 1638 1675 /* 1639 - * Objects left in the slab. If it 1640 - * was not on the partial list before 1676 + * Objects left in the slab. If it was not on the partial list before 1641 1677 * then add it. 1642 1678 */ 1643 - if (unlikely(prior == page->end)) { 1679 + if (unlikely(!prior)) { 1644 1680 add_partial(get_node(s, page_to_nid(page)), page, 1); 1645 1681 stat(c, FREE_ADD_PARTIAL); 1646 1682 } ··· 1649 1687 return; 1650 1688 1651 1689 slab_empty: 1652 - if (prior != page->end) { 1690 + if (prior) { 1653 1691 /* 1654 1692 * Slab still on the partial list. 1655 1693 */ ··· 1686 1724 unsigned long flags; 1687 1725 1688 1726 local_irq_save(flags); 1689 - debug_check_no_locks_freed(object, s->objsize); 1690 1727 c = get_cpu_slab(s, smp_processor_id()); 1728 + debug_check_no_locks_freed(object, c->objsize); 1691 1729 if (likely(page == c->page && c->node >= 0)) { 1692 1730 object[c->offset] = c->freelist; 1693 1731 c->freelist = object; ··· 1850 1888 unsigned long align, unsigned long size) 1851 1889 { 1852 1890 /* 1853 - * If the user wants hardware cache aligned objects then 1854 - * follow that suggestion if the object is sufficiently 1855 - * large. 1891 + * If the user wants hardware cache aligned objects then follow that 1892 + * suggestion if the object is sufficiently large. 1856 1893 * 1857 - * The hardware cache alignment cannot override the 1858 - * specified alignment though. If that is greater 1859 - * then use it. 1894 + * The hardware cache alignment cannot override the specified 1895 + * alignment though. If that is greater then use it. 1860 1896 */ 1861 1897 if ((flags & SLAB_HWCACHE_ALIGN) && 1862 1898 size > cache_line_size() / 2) ··· 1870 1910 struct kmem_cache_cpu *c) 1871 1911 { 1872 1912 c->page = NULL; 1873 - c->freelist = (void *)PAGE_MAPPING_ANON; 1913 + c->freelist = NULL; 1874 1914 c->node = 0; 1875 1915 c->offset = s->offset / sizeof(void *); 1876 1916 c->objsize = s->objsize; ··· 2052 2092 #endif 2053 2093 init_kmem_cache_node(n); 2054 2094 atomic_long_inc(&n->nr_slabs); 2095 + 2055 2096 /* 2056 2097 * lockdep requires consistent irq usage for each lock 2057 2098 * so even though there cannot be a race this early in ··· 2134 2173 unsigned long align = s->align; 2135 2174 2136 2175 /* 2176 + * Round up object size to the next word boundary. We can only 2177 + * place the free pointer at word boundaries and this determines 2178 + * the possible location of the free pointer. 2179 + */ 2180 + size = ALIGN(size, sizeof(void *)); 2181 + 2182 + #ifdef CONFIG_SLUB_DEBUG 2183 + /* 2137 2184 * Determine if we can poison the object itself. If the user of 2138 2185 * the slab may touch the object after free or before allocation 2139 2186 * then we should never poison the object itself. ··· 2152 2183 else 2153 2184 s->flags &= ~__OBJECT_POISON; 2154 2185 2155 - /* 2156 - * Round up object size to the next word boundary. We can only 2157 - * place the free pointer at word boundaries and this determines 2158 - * the possible location of the free pointer. 2159 - */ 2160 - size = ALIGN(size, sizeof(void *)); 2161 2186 2162 - #ifdef CONFIG_SLUB_DEBUG 2163 2187 /* 2164 2188 * If we are Redzoning then check if there is some space between the 2165 2189 * end of the object and the free pointer. If not then add an ··· 2305 2343 /* 2306 2344 * We could also check if the object is on the slabs freelist. 2307 2345 * But this would be too expensive and it seems that the main 2308 - * purpose of kmem_ptr_valid is to check if the object belongs 2346 + * purpose of kmem_ptr_valid() is to check if the object belongs 2309 2347 * to a certain slab. 2310 2348 */ 2311 2349 return 1; ··· 2592 2630 } 2593 2631 EXPORT_SYMBOL(__kmalloc); 2594 2632 2633 + static void *kmalloc_large_node(size_t size, gfp_t flags, int node) 2634 + { 2635 + struct page *page = alloc_pages_node(node, flags | __GFP_COMP, 2636 + get_order(size)); 2637 + 2638 + if (page) 2639 + return page_address(page); 2640 + else 2641 + return NULL; 2642 + } 2643 + 2595 2644 #ifdef CONFIG_NUMA 2596 2645 void *__kmalloc_node(size_t size, gfp_t flags, int node) 2597 2646 { 2598 2647 struct kmem_cache *s; 2599 2648 2600 2649 if (unlikely(size > PAGE_SIZE)) 2601 - return kmalloc_large(size, flags); 2650 + return kmalloc_large_node(size, flags, node); 2602 2651 2603 2652 s = get_slab(size, flags); 2604 2653 ··· 2626 2653 struct page *page; 2627 2654 struct kmem_cache *s; 2628 2655 2629 - BUG_ON(!object); 2630 2656 if (unlikely(object == ZERO_SIZE_PTR)) 2631 2657 return 0; 2632 2658 2633 2659 page = virt_to_head_page(object); 2634 - BUG_ON(!page); 2635 2660 2636 2661 if (unlikely(!PageSlab(page))) 2637 2662 return PAGE_SIZE << compound_order(page); 2638 2663 2639 2664 s = page->slab; 2640 - BUG_ON(!s); 2641 2665 2666 + #ifdef CONFIG_SLUB_DEBUG 2642 2667 /* 2643 2668 * Debugging requires use of the padding between object 2644 2669 * and whatever may come after it. ··· 2644 2673 if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) 2645 2674 return s->objsize; 2646 2675 2676 + #endif 2647 2677 /* 2648 2678 * If we have the need to store the freelist pointer 2649 2679 * back there or track user information then we can ··· 2652 2680 */ 2653 2681 if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER)) 2654 2682 return s->inuse; 2655 - 2656 2683 /* 2657 2684 * Else we can use all the padding etc for the allocation 2658 2685 */ ··· 2928 2957 /* 2929 2958 * Patch up the size_index table if we have strange large alignment 2930 2959 * requirements for the kmalloc array. This is only the case for 2931 - * mips it seems. The standard arches will not generate any code here. 2960 + * MIPS it seems. The standard arches will not generate any code here. 2932 2961 * 2933 2962 * Largest permitted alignment is 256 bytes due to the way we 2934 2963 * handle the index determination for the smaller caches. ··· 2956 2985 #else 2957 2986 kmem_size = sizeof(struct kmem_cache); 2958 2987 #endif 2959 - 2960 2988 2961 2989 printk(KERN_INFO 2962 2990 "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d," ··· 3053 3083 */ 3054 3084 for_each_online_cpu(cpu) 3055 3085 get_cpu_slab(s, cpu)->objsize = s->objsize; 3086 + 3056 3087 s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *))); 3057 3088 up_write(&slub_lock); 3089 + 3058 3090 if (sysfs_slab_alias(s, name)) 3059 3091 goto err; 3060 3092 return s; 3061 3093 } 3094 + 3062 3095 s = kmalloc(kmem_size, GFP_KERNEL); 3063 3096 if (s) { 3064 3097 if (kmem_cache_open(s, GFP_KERNEL, name, ··· 3157 3184 struct kmem_cache *s; 3158 3185 3159 3186 if (unlikely(size > PAGE_SIZE)) 3160 - return kmalloc_large(size, gfpflags); 3187 + return kmalloc_large_node(size, gfpflags, node); 3161 3188 3162 3189 s = get_slab(size, gfpflags); 3163 3190 ··· 3172 3199 unsigned long *map) 3173 3200 { 3174 3201 void *p; 3175 - void *addr = slab_address(page); 3202 + void *addr = page_address(page); 3176 3203 3177 3204 if (!check_slab(s, page) || 3178 3205 !on_freelist(s, page, NULL)) ··· 3455 3482 static void process_slab(struct loc_track *t, struct kmem_cache *s, 3456 3483 struct page *page, enum track_item alloc) 3457 3484 { 3458 - void *addr = slab_address(page); 3485 + void *addr = page_address(page); 3459 3486 DECLARE_BITMAP(map, s->objects); 3460 3487 void *p; 3461 3488 ··· 3564 3591 #define SO_CPU (1 << SL_CPU) 3565 3592 #define SO_OBJECTS (1 << SL_OBJECTS) 3566 3593 3567 - static unsigned long slab_objects(struct kmem_cache *s, 3568 - char *buf, unsigned long flags) 3594 + static ssize_t show_slab_objects(struct kmem_cache *s, 3595 + char *buf, unsigned long flags) 3569 3596 { 3570 3597 unsigned long total = 0; 3571 3598 int cpu; ··· 3575 3602 unsigned long *per_cpu; 3576 3603 3577 3604 nodes = kzalloc(2 * sizeof(unsigned long) * nr_node_ids, GFP_KERNEL); 3605 + if (!nodes) 3606 + return -ENOMEM; 3578 3607 per_cpu = nodes + nr_node_ids; 3579 3608 3580 3609 for_each_possible_cpu(cpu) { ··· 3729 3754 3730 3755 static ssize_t slabs_show(struct kmem_cache *s, char *buf) 3731 3756 { 3732 - return slab_objects(s, buf, SO_FULL|SO_PARTIAL|SO_CPU); 3757 + return show_slab_objects(s, buf, SO_FULL|SO_PARTIAL|SO_CPU); 3733 3758 } 3734 3759 SLAB_ATTR_RO(slabs); 3735 3760 3736 3761 static ssize_t partial_show(struct kmem_cache *s, char *buf) 3737 3762 { 3738 - return slab_objects(s, buf, SO_PARTIAL); 3763 + return show_slab_objects(s, buf, SO_PARTIAL); 3739 3764 } 3740 3765 SLAB_ATTR_RO(partial); 3741 3766 3742 3767 static ssize_t cpu_slabs_show(struct kmem_cache *s, char *buf) 3743 3768 { 3744 - return slab_objects(s, buf, SO_CPU); 3769 + return show_slab_objects(s, buf, SO_CPU); 3745 3770 } 3746 3771 SLAB_ATTR_RO(cpu_slabs); 3747 3772 3748 3773 static ssize_t objects_show(struct kmem_cache *s, char *buf) 3749 3774 { 3750 - return slab_objects(s, buf, SO_FULL|SO_PARTIAL|SO_CPU|SO_OBJECTS); 3775 + return show_slab_objects(s, buf, SO_FULL|SO_PARTIAL|SO_CPU|SO_OBJECTS); 3751 3776 } 3752 3777 SLAB_ATTR_RO(objects); 3753 3778 ··· 3946 3971 #endif 3947 3972 3948 3973 #ifdef CONFIG_SLUB_STATS 3949 - 3950 3974 static int show_stat(struct kmem_cache *s, char *buf, enum stat_item si) 3951 3975 { 3952 3976 unsigned long sum = 0; ··· 4129 4155 #define ID_STR_LENGTH 64 4130 4156 4131 4157 /* Create a unique string id for a slab cache: 4132 - * format 4133 - * :[flags-]size:[memory address of kmemcache] 4158 + * 4159 + * Format :[flags-]size 4134 4160 */ 4135 4161 static char *create_unique_id(struct kmem_cache *s) 4136 4162 {