From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kamezawa.hiroyu@jp.fujitsu.com, riel@redhat.com,
hugh.dickins@tiscali.co.uk
Subject: Re: [patch] mm: release swap slots for actively used pages
Date: Wed, 27 May 2009 16:15:35 -0700 [thread overview]
Message-ID: <20090527161535.ac2dd1ba.akpm@linux-foundation.org> (raw)
In-Reply-To: <1243388859-9760-1-git-send-email-hannes@cmpxchg.org>
On Wed, 27 May 2009 03:47:39 +0200
Johannes Weiner <hannes@cmpxchg.org> wrote:
> For anonymous pages activated by the reclaim scan or faulted from an
> evicted page table entry we should always try to free up swap space.
>
> Both events indicate that the page is in active use and a possible
> change in the working set. Thus removing the slot association from
> the page increases the chance of the page being placed near its new
> LRU buddies on the next eviction and helps keeping the amount of stale
> swap cache entries low.
>
> try_to_free_swap() inherently only succeeds when the last user of the
> swap slot vanishes so it is safe to use from places where that single
> mapping just brought the page back to life.
>
Seems that this has a risk of worsening swap fragmentation for some
situations. Or not, I have no way of knowing, really.
> diff --git a/mm/memory.c b/mm/memory.c
> index 8b4e40e..407ebf7 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2671,8 +2671,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
> mem_cgroup_commit_charge_swapin(page, ptr);
>
> swap_free(entry);
> - if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page))
> - try_to_free_swap(page);
> + try_to_free_swap(page);
> unlock_page(page);
>
> if (write_access) {
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 621708f..2f0549d 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -788,7 +788,7 @@ cull_mlocked:
>
> activate_locked:
> /* Not a candidate for swapping, so reclaim swap space. */
> - if (PageSwapCache(page) && vm_swap_full())
> + if (PageSwapCache(page))
> try_to_free_swap(page);
> VM_BUG_ON(PageActive(page));
> SetPageActive(page);
How are we to know that this is a desirable patch for Linux??
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kamezawa.hiroyu@jp.fujitsu.com, riel@redhat.com,
hugh.dickins@tiscali.co.uk
Subject: Re: [patch] mm: release swap slots for actively used pages
Date: Wed, 27 May 2009 16:15:35 -0700 [thread overview]
Message-ID: <20090527161535.ac2dd1ba.akpm@linux-foundation.org> (raw)
In-Reply-To: <1243388859-9760-1-git-send-email-hannes@cmpxchg.org>
On Wed, 27 May 2009 03:47:39 +0200
Johannes Weiner <hannes@cmpxchg.org> wrote:
> For anonymous pages activated by the reclaim scan or faulted from an
> evicted page table entry we should always try to free up swap space.
>
> Both events indicate that the page is in active use and a possible
> change in the working set. Thus removing the slot association from
> the page increases the chance of the page being placed near its new
> LRU buddies on the next eviction and helps keeping the amount of stale
> swap cache entries low.
>
> try_to_free_swap() inherently only succeeds when the last user of the
> swap slot vanishes so it is safe to use from places where that single
> mapping just brought the page back to life.
>
Seems that this has a risk of worsening swap fragmentation for some
situations. Or not, I have no way of knowing, really.
> diff --git a/mm/memory.c b/mm/memory.c
> index 8b4e40e..407ebf7 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2671,8 +2671,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
> mem_cgroup_commit_charge_swapin(page, ptr);
>
> swap_free(entry);
> - if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page))
> - try_to_free_swap(page);
> + try_to_free_swap(page);
> unlock_page(page);
>
> if (write_access) {
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 621708f..2f0549d 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -788,7 +788,7 @@ cull_mlocked:
>
> activate_locked:
> /* Not a candidate for swapping, so reclaim swap space. */
> - if (PageSwapCache(page) && vm_swap_full())
> + if (PageSwapCache(page))
> try_to_free_swap(page);
> VM_BUG_ON(PageActive(page));
> SetPageActive(page);
How are we to know that this is a desirable patch for Linux??
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-05-27 23:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 1:47 [patch] mm: release swap slots for actively used pages Johannes Weiner
2009-05-27 1:47 ` Johannes Weiner
2009-05-27 23:15 ` Andrew Morton [this message]
2009-05-27 23:15 ` Andrew Morton
2009-05-28 0:23 ` KAMEZAWA Hiroyuki
2009-05-28 0:23 ` KAMEZAWA Hiroyuki
2009-05-28 0:34 ` Johannes Weiner
2009-05-28 0:34 ` Johannes Weiner
2009-06-04 21:22 ` Hugh Dickins
2009-06-04 21:22 ` Hugh Dickins
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=20090527161535.ac2dd1ba.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hugh.dickins@tiscali.co.uk \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.