linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Cc: linux-mm@kvack.org, hughd@google.com, riel@redhat.com,
	akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
	n-horiguchi@ah.jp.nec.com, aarcange@redhat.com,
	iamjoonsoo.kim@lge.com, gorcunov@openvz.org,
	linux-kernel@vger.kernel.org, mgorman@suse.de,
	rientjes@google.com, vbabka@suse.cz,
	aneesh.kumar@linux.vnet.ibm.com, hannes@cmpxchg.org,
	boaz@plexistor.com
Subject: Re: [RFC PATCH 1/3] mm, thp: revert allocstall comparing
Date: Tue, 14 Jun 2016 09:07:02 +0200	[thread overview]
Message-ID: <20160614070701.GC5681@dhcp22.suse.cz> (raw)
In-Reply-To: <1465672561-29608-2-git-send-email-ebru.akagunduz@gmail.com>

On Sat 11-06-16 22:15:59, Ebru Akagunduz wrote:
> This patch takes back allocstall comparing when deciding
> whether swapin worthwhile because it does not work,
> if vmevent disabled.
> 
> Related commit:
> http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=2548306628308aa6a326640d345a737bc898941d

I guess it would be easier to simply drop
mm-thp-avoid-unnecessary-swapin-in-khugepaged.patch

> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
> ---
>  mm/khugepaged.c | 31 ++++++++-----------------------
>  1 file changed, 8 insertions(+), 23 deletions(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 0ac63f7..e3d8da7 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -68,7 +68,6 @@ static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
>   */
>  static unsigned int khugepaged_max_ptes_none __read_mostly;
>  static unsigned int khugepaged_max_ptes_swap __read_mostly;
> -static unsigned long allocstall;
>  
>  static int khugepaged(void *none);
>  
> @@ -926,7 +925,6 @@ static void collapse_huge_page(struct mm_struct *mm,
>  	struct page *new_page;
>  	spinlock_t *pmd_ptl, *pte_ptl;
>  	int isolated = 0, result = 0;
> -	unsigned long swap, curr_allocstall;
>  	struct mem_cgroup *memcg;
>  	unsigned long mmun_start;	/* For mmu_notifiers */
>  	unsigned long mmun_end;		/* For mmu_notifiers */
> @@ -955,8 +953,6 @@ static void collapse_huge_page(struct mm_struct *mm,
>  		goto out_nolock;
>  	}
>  
> -	swap = get_mm_counter(mm, MM_SWAPENTS);
> -	curr_allocstall = sum_vm_event(ALLOCSTALL);
>  	down_read(&mm->mmap_sem);
>  	result = hugepage_vma_revalidate(mm, address);
>  	if (result) {
> @@ -972,22 +968,15 @@ static void collapse_huge_page(struct mm_struct *mm,
>  		up_read(&mm->mmap_sem);
>  		goto out_nolock;
>  	}
> -
>  	/*
> -	 * Don't perform swapin readahead when the system is under pressure,
> -	 * to avoid unnecessary resource consumption.
> +	 * __collapse_huge_page_swapin always returns with mmap_sem
> +	 * locked.  If it fails, release mmap_sem and jump directly
> +	 * out.  Continuing to collapse causes inconsistency.
>  	 */
> -	if (allocstall == curr_allocstall && swap != 0) {
> -		/*
> -		 * __collapse_huge_page_swapin always returns with mmap_sem
> -		 * locked.  If it fails, release mmap_sem and jump directly
> -		 * out.  Continuing to collapse causes inconsistency.
> -		 */
> -		if (!__collapse_huge_page_swapin(mm, vma, address, pmd)) {
> -			mem_cgroup_cancel_charge(new_page, memcg, true);
> -			up_read(&mm->mmap_sem);
> -			goto out_nolock;
> -		}
> +	if (!__collapse_huge_page_swapin(mm, vma, address, pmd)) {
> +		mem_cgroup_cancel_charge(new_page, memcg, true);
> +		up_read(&mm->mmap_sem);
> +		goto out_nolock;
>  	}
>  
>  	up_read(&mm->mmap_sem);
> @@ -1822,7 +1811,6 @@ static void khugepaged_wait_work(void)
>  		if (!scan_sleep_jiffies)
>  			return;
>  
> -		allocstall = sum_vm_event(ALLOCSTALL);
>  		khugepaged_sleep_expire = jiffies + scan_sleep_jiffies;
>  		wait_event_freezable_timeout(khugepaged_wait,
>  					     khugepaged_should_wakeup(),
> @@ -1830,10 +1818,8 @@ static void khugepaged_wait_work(void)
>  		return;
>  	}
>  
> -	if (khugepaged_enabled()) {
> -		allocstall = sum_vm_event(ALLOCSTALL);
> +	if (khugepaged_enabled())
>  		wait_event_freezable(khugepaged_wait, khugepaged_wait_event());
> -	}
>  }
>  
>  static int khugepaged(void *none)
> @@ -1842,7 +1828,6 @@ static int khugepaged(void *none)
>  
>  	set_freezable();
>  	set_user_nice(current, MAX_NICE);
> -	allocstall = sum_vm_event(ALLOCSTALL);
>  
>  	while (!kthread_should_stop()) {
>  		khugepaged_do_scan();
> -- 
> 1.9.1

-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2016-06-14  7:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 19:15 [RFC PATCH 0/3] mm, thp: convert from optimistic to conservative Ebru Akagunduz
2016-06-11 19:15 ` [RFC PATCH 1/3] mm, thp: revert allocstall comparing Ebru Akagunduz
2016-06-13 18:32   ` Ebru Akagunduz
2016-06-14  7:07   ` Michal Hocko [this message]
2016-06-11 19:16 ` [RFC PATCH 2/3] mm, thp: convert from optimistic to conservative Ebru Akagunduz
2016-06-13 18:35   ` Ebru Akagunduz
2016-06-14  7:18   ` Michal Hocko
2016-06-15  6:40   ` Minchan Kim
2016-06-16  9:08     ` Ebru Akagunduz
2016-06-11 19:16 ` [RFC PATCH 3/3] doc: add information about min_ptes_young Ebru Akagunduz
2016-06-13 18:37   ` Ebru Akagunduz
2016-06-13 18:30 ` [RFC PATCH 0/3] mm, thp: convert from optimistic to conservative Ebru Akagunduz

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=20160614070701.GC5681@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=boaz@plexistor.com \
    --cc=ebru.akagunduz@gmail.com \
    --cc=gorcunov@openvz.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /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).