Re: [PATCH v4] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order

2020-07-02 Thread Matthew Wilcox
On Thu, Jul 02, 2020 at 03:27:59PM +, Long Li wrote: > --- > changes in V4: > -Change the check function name to kmalloc_check_flags() > -Put the flags check into the kmalloc_check_flags() The point of not doing that was that this is unlikely(). With your change there is now a function call

[PATCH v4] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order

2020-07-02 Thread Long Li
kmalloc cannot allocate memory from HIGHMEM. Allocating large amounts of memory currently bypasses the check and will simply leak the memory when page_address() returns NULL. To fix this, factor the GFP_SLAB_BUG_MASK check out of slab & slub, and call it from kmalloc_order() as well. In order to