linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vijay Balakrishna <vijayb@linux.microsoft.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Oleg Nesterov <oleg@redhat.com>, Song Liu <songliubraving@fb.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Michal Hocko <mhocko@suse.com>, Allen Pais <apais@microsoft.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [v3 2/2] mm: khugepaged: avoid overriding min_free_kbytes set by user
Date: Wed, 16 Sep 2020 21:22:06 -0700	[thread overview]
Message-ID: <a9b53080-9dc3-c1ee-8126-eaf8e38ce736@linux.microsoft.com> (raw)
In-Reply-To: <1600305709-2319-3-git-send-email-vijayb@linux.microsoft.com>

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@linux.microsoft.com>
> Cc: stable@vger.kernel.org
> Reviewed-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> ---
>   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
> 

  reply	other threads:[~2020-09-17  4:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  1:21 [v3 0/2] recalculate min_free_kbytes post memory hotplug Vijay Balakrishna
2020-09-17  1:21 ` [v3 1/2] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged Vijay Balakrishna
2020-09-21 12:55   ` Sasha Levin
2020-09-23 21:27   ` Vijay Balakrishna
2020-09-25  2:51     ` Andrew Morton
2020-09-25  7:45       ` Michal Hocko
2020-09-25  7:42   ` Michal Hocko
2020-09-25 16:31     ` Vijay Balakrishna
2020-09-17  1:21 ` [v3 2/2] mm: khugepaged: avoid overriding min_free_kbytes set by user Vijay Balakrishna
2020-09-17  4:22   ` Vijay Balakrishna [this message]
2020-09-21 12:54   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9b53080-9dc3-c1ee-8126-eaf8e38ce736@linux.microsoft.com \
    --to=vijayb@linux.microsoft.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apais@microsoft.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=oleg@redhat.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).