Merge tag 'staging-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux] / mm / util.c
index 9e3ebd2..4df23d6 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
 #include <linux/vmalloc.h>
 #include <linux/userfaultfd_k.h>
 
-#include <asm/sections.h>
 #include <linux/uaccess.h>
 
 #include "internal.h"
 
-static inline int is_kernel_rodata(unsigned long addr)
-{
-       return addr >= (unsigned long)__start_rodata &&
-               addr < (unsigned long)__end_rodata;
-}
-
 /**
  * kfree_const - conditionally free memory
  * @x: pointer to the memory
@@ -442,7 +435,7 @@ EXPORT_SYMBOL(kvmalloc_node);
  * It is slightly more efficient to use kfree() or vfree() if you are certain
  * that you know which one to use.
  *
- * Context: Any context except NMI.
+ * Context: Either preemptible task context or not-NMI interrupt.
  */
 void kvfree(const void *addr)
 {
@@ -600,7 +593,7 @@ unsigned long vm_commit_limit(void)
        if (sysctl_overcommit_kbytes)
                allowed = sysctl_overcommit_kbytes >> (PAGE_SHIFT - 10);
        else
-               allowed = ((totalram_pages - hugetlb_total_pages())
+               allowed = ((totalram_pages() - hugetlb_total_pages())
                           * sysctl_overcommit_ratio / 100);
        allowed += total_swap_pages;
 
@@ -685,8 +678,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
                 * Part of the kernel memory, which can be released
                 * under memory pressure.
                 */
-               free += global_node_page_state(
-                       NR_INDIRECTLY_RECLAIMABLE_BYTES) >> PAGE_SHIFT;
+               free += global_node_page_state(NR_KERNEL_MISC_RECLAIMABLE);
 
                /*
                 * Leave reserved pages. The pages are not for anonymous pages.