diff options
Diffstat (limited to 'mm/util.c')
| -rw-r--r-- | mm/util.c | 17 | 
1 files changed, 5 insertions, 12 deletions
| diff --git a/mm/util.c b/mm/util.c index e58151a61255..7e43369064c8 100644 --- a/mm/util.c +++ b/mm/util.c @@ -549,13 +549,10 @@ EXPORT_SYMBOL(vm_mmap);   * Uses kmalloc to get the memory but if the allocation fails then falls back   * to the vmalloc allocator. Use kvfree for freeing the memory.   * - * Reclaim modifiers - __GFP_NORETRY and __GFP_NOFAIL are not supported. + * GFP_NOWAIT and GFP_ATOMIC are not supported, neither is the __GFP_NORETRY modifier.   * __GFP_RETRY_MAYFAIL is supported, and it should be used only if kmalloc is   * preferable to the vmalloc fallback, due to visible performance drawbacks.   * - * Please note that any use of gfp flags outside of GFP_KERNEL is careful to not - * fall back to vmalloc. - *   * Return: pointer to the allocated memory of %NULL in case of failure   */  void *kvmalloc_node(size_t size, gfp_t flags, int node) @@ -564,13 +561,6 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node)  	void *ret;  	/* -	 * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables) -	 * so the given set of flags has to be compatible. -	 */ -	if ((flags & GFP_KERNEL) != GFP_KERNEL) -		return kmalloc_node(size, flags, node); - -	/*  	 * We want to attempt a large physically contiguous block first because  	 * it is less likely to fragment multiple larger blocks and therefore  	 * contribute to a long term fragmentation less than vmalloc fallback. @@ -582,6 +572,9 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node)  		if (!(kmalloc_flags & __GFP_RETRY_MAYFAIL))  			kmalloc_flags |= __GFP_NORETRY; + +		/* nofail semantic is implemented by the vmalloc fallback */ +		kmalloc_flags &= ~__GFP_NOFAIL;  	}  	ret = kmalloc_node(size, kmalloc_flags, node); @@ -670,7 +663,7 @@ bool folio_mapped(struct folio *folio)  {  	long i, nr; -	if (folio_test_single(folio)) +	if (!folio_test_large(folio))  		return atomic_read(&folio->_mapcount) >= 0;  	if (atomic_read(folio_mapcount_ptr(folio)) >= 0)  		return true; |