-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there people, i only need a confirmation on some unclear issues concerning the following function: <include/linux/slab.h> 77 static inline void *kmalloc(size_t size, int flags) 78 { 79 if (__builtin_constant_p(size)) { 80 int i = 0; 81 #define CACHE(x) \ 82 if (size <= x) \ 83 goto found; \ 84 else \ 85 i++; 86 #include "kmalloc_sizes.h" 87 #undef CACHE 88 { 89 extern void __you_cannot_kmalloc_that_much(void); 90 __you_cannot_kmalloc_that_much(); 91 } 92 found: 93 return kmem_cache_alloc((flags & GFP_DMA) ? 94 malloc_sizes[i].cs_dmacachep : 95 malloc_sizes[i].cs_cachep, flags); 96 } 97 return __kmalloc(size, flags); 98 } I understand that the CACHE macro is used to search the malloc_sizes array to find a slab object that is (size <= x) and if it is found, we jump to the found label where we call kmem_cache_alloc(). After we #undef CACHE, we have a block with that external function that is declared nowhere. After googling a while, I think I know what this does but i'm not sure - when, at compile time, something requests a slab object that is bigger than the alloc'd ones, we break compilation and force the caller to change its call to kmalloc in order to request a more suitable size object. I don't understand the thoughts behind that, though, thus my question. Thanks in advance for your help, Boris. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBDf64iBySr3Fn37QRAsreAJ4nAZof1ixOM3ZDo2ADIMjgXrYCzACfXBVc VMqT17YfOFPlmPyEXOLjxic= =i6PV -----END PGP SIGNATURE----- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/