* [PATCH] mm: move buffer_heads_over_limit check up
@ 2012-02-18 0:00 Hugh Dickins
2012-02-18 0:11 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2012-02-18 0:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm
Not a functional change, just a minor internal cleanup: move the
buffer_heads_over_limit processing up from move_active_pages_to_lru()
(where it has to drop lock and reloop) to its caller shrink_active_list().
Signed-off-by: Hugh Dickins <hughd@google.com>
---
mm/vmscan.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
--- mmotm.orig/mm/vmscan.c 2012-02-07 16:59:13.000000000 -0800
+++ mmotm/mm/vmscan.c 2012-02-07 17:07:23.800524771 -0800
@@ -1641,18 +1641,6 @@ static void move_active_pages_to_lru(str
unsigned long pgmoved = 0;
struct page *page;
- if (buffer_heads_over_limit) {
- spin_unlock_irq(&zone->lru_lock);
- list_for_each_entry(page, list, lru) {
- if (page_has_private(page) && trylock_page(page)) {
- if (page_has_private(page))
- try_to_release_page(page, 0);
- unlock_page(page);
- }
- }
- spin_lock_irq(&zone->lru_lock);
- }
-
while (!list_empty(list)) {
struct lruvec *lruvec;
@@ -1734,6 +1722,13 @@ static void shrink_active_list(unsigned
continue;
}
+ if (buffer_heads_over_limit &&
+ page_has_private(page) && trylock_page(page)) {
+ if (page_has_private(page))
+ try_to_release_page(page, 0);
+ unlock_page(page);
+ }
+
if (page_referenced(page, 0, mz->mem_cgroup, &vm_flags)) {
nr_rotated += hpage_nr_pages(page);
/*
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: move buffer_heads_over_limit check up
2012-02-18 0:00 [PATCH] mm: move buffer_heads_over_limit check up Hugh Dickins
@ 2012-02-18 0:11 ` Andrew Morton
2012-02-18 2:41 ` Hugh Dickins
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2012-02-18 0:11 UTC (permalink / raw)
To: Hugh Dickins; +Cc: linux-mm, Mel Gorman
On Fri, 17 Feb 2012 16:00:14 -0800 (PST)
Hugh Dickins <hughd@google.com> wrote:
> Not a functional change, just a minor internal cleanup: move the
> buffer_heads_over_limit processing up from move_active_pages_to_lru()
> (where it has to drop lock and reloop) to its caller shrink_active_list().
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> mm/vmscan.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> --- mmotm.orig/mm/vmscan.c 2012-02-07 16:59:13.000000000 -0800
> +++ mmotm/mm/vmscan.c 2012-02-07 17:07:23.800524771 -0800
> @@ -1641,18 +1641,6 @@ static void move_active_pages_to_lru(str
> unsigned long pgmoved = 0;
> struct page *page;
>
> - if (buffer_heads_over_limit) {
> - spin_unlock_irq(&zone->lru_lock);
> - list_for_each_entry(page, list, lru) {
> - if (page_has_private(page) && trylock_page(page)) {
> - if (page_has_private(page))
> - try_to_release_page(page, 0);
> - unlock_page(page);
> - }
> - }
> - spin_lock_irq(&zone->lru_lock);
> - }
> -
> while (!list_empty(list)) {
> struct lruvec *lruvec;
>
> @@ -1734,6 +1722,13 @@ static void shrink_active_list(unsigned
> continue;
> }
>
> + if (buffer_heads_over_limit &&
> + page_has_private(page) && trylock_page(page)) {
> + if (page_has_private(page))
> + try_to_release_page(page, 0);
> + unlock_page(page);
> + }
> +
> if (page_referenced(page, 0, mz->mem_cgroup, &vm_flags)) {
> nr_rotated += hpage_nr_pages(page);
> /*
yup.
I don't think there's a lot of point in trying to micro-optimise the
buffer_heads_over_limit==true case, either. But I suppose that
pointlessly locking 1000000 anon pages is indeed pointless. Hopefully
there _is_ a point in micro-optimising the actual test for
buffer_heads_over_limit==true. So...
--- a/mm/vmscan.c~mm-vmscan-forcibly-scan-highmem-if-there-are-too-many-buffer_heads-pinning-highmem-fix-fix
+++ a/mm/vmscan.c
@@ -1723,11 +1723,12 @@ static void shrink_active_list(unsigned
continue;
}
- if (buffer_heads_over_limit &&
- page_has_private(page) && trylock_page(page)) {
- if (page_has_private(page))
- try_to_release_page(page, 0);
- unlock_page(page);
+ if (unlikely(buffer_heads_over_limit)) {
+ if (page_has_private(page) && trylock_page(page)) {
+ if (page_has_private(page))
+ try_to_release_page(page, 0);
+ unlock_page(page);
+ }
}
if (page_referenced(page, 0, mz->mem_cgroup, &vm_flags)) {
_
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: move buffer_heads_over_limit check up
2012-02-18 0:11 ` Andrew Morton
@ 2012-02-18 2:41 ` Hugh Dickins
0 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2012-02-18 2:41 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, Mel Gorman, Konstantin Khelbnikov
On Fri, 17 Feb 2012, Andrew Morton wrote:
>
> I don't think there's a lot of point in trying to micro-optimise the
> buffer_heads_over_limit==true case, either. But I suppose that
> pointlessly locking 1000000 anon pages is indeed pointless. Hopefully
> there _is_ a point in micro-optimising the actual test for
> buffer_heads_over_limit==true. So...
That's fine, yes, and thanks for putting this in. I just want to
exonerate Mel: it's not a fix to his useful work on buffer_heads_over_limit,
but I don't think he'll mind terribly that you've named it thus.
If it's a fix to anything, it's to my 3.3 free_hot_cold_page_list-ification
of shrink_active_list(), which was silly to leave the buffer_heads business
down there in move_active_pages_to_lru().
And the only reason I'm concerned to get it in, is that it's in an area
which I then trample over in the per-memcg per-zone locking series (as
is Hillf's rearrangement around update_isolated_counts()), so it's
convenient for me to have both of those in the base, instead of
having to put them in a prologue.
If I were to worry about the buffer_heads_over_limit situation itself,
I might worry about the unevictable pages which we never scan.
Hugh
>
> --- a/mm/vmscan.c~mm-vmscan-forcibly-scan-highmem-if-there-are-too-many-buffer_heads-pinning-highmem-fix-fix
> +++ a/mm/vmscan.c
> @@ -1723,11 +1723,12 @@ static void shrink_active_list(unsigned
> continue;
> }
>
> - if (buffer_heads_over_limit &&
> - page_has_private(page) && trylock_page(page)) {
> - if (page_has_private(page))
> - try_to_release_page(page, 0);
> - unlock_page(page);
> + if (unlikely(buffer_heads_over_limit)) {
> + if (page_has_private(page) && trylock_page(page)) {
> + if (page_has_private(page))
> + try_to_release_page(page, 0);
> + unlock_page(page);
> + }
> }
>
> if (page_referenced(page, 0, mz->mem_cgroup, &vm_flags)) {
> _
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-18 2:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-18 0:00 [PATCH] mm: move buffer_heads_over_limit check up Hugh Dickins
2012-02-18 0:11 ` Andrew Morton
2012-02-18 2:41 ` Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox