Re: [v3 2/2] mm: khugepaged: avoid overriding min_free_kbytes set by user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please ignore this patch.  I forgot to run scripts/checkpatch.pl and see

CHECK: Alignment should match open parenthesis
#30: FILE: mm/khugepaged.c:2287:
+       if (recommended_min > min_free_kbytes ||
+               recommended_min > user_min_free_kbytes) {

ERROR: do not initialise globals to 0
#43: FILE: mm/page_alloc.c:318:
+int user_min_free_kbytes = 0;

Sorry for trouble, I will send a new version.

Vijay

On 9/16/2020 6:21 PM, Vijay Balakrishna wrote:
set_recommended_min_free_kbytes need to honor min_free_kbytes set by the
user.  Post start-of-day THP enable or memory hotplug operations can
lose user specified min_free_kbytes, in particular when it is higher than
calculated recommended value.  user_min_free_kbytes initialized to 0
to avoid undesired result when comparing with  "unsigned long" type.

Signed-off-by: Vijay Balakrishna <vijayb@xxxxxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
---
  mm/khugepaged.c | 3 ++-
  mm/page_alloc.c | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 4f7107476a6f..3c1147816d12 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2283,7 +2283,8 @@ static void set_recommended_min_free_kbytes(void)
  			      (unsigned long) nr_free_buffer_pages() / 20);
  	recommended_min <<= (PAGE_SHIFT-10);
- if (recommended_min > min_free_kbytes) {
+	if (recommended_min > min_free_kbytes ||
+		recommended_min > user_min_free_kbytes) {
  		if (user_min_free_kbytes >= 0)
  			pr_info("raising min_free_kbytes from %d to %lu to help transparent hugepage allocations\n",
  				min_free_kbytes, recommended_min);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fab5e97dc9ca..7b81fb139034 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -315,7 +315,7 @@ compound_page_dtor * const compound_page_dtors[NR_COMPOUND_DTORS] = {
  };
int min_free_kbytes = 1024;
-int user_min_free_kbytes = -1;
+int user_min_free_kbytes = 0;
  #ifdef CONFIG_DISCONTIGMEM
  /*
   * DiscontigMem defines memory ranges as separate pg_data_t even if the ranges





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux