+ mm-cleanup-and-document-reclaim-recursion.patch added to -mm tree

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

 



The patch titled
     mm: cleanup and document reclaim recursion
has been added to the -mm tree.  Its filename is
     mm-cleanup-and-document-reclaim-recursion.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: mm: cleanup and document reclaim recursion
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>

Cleanup and document the reclaim recursion avoiding properties of
PF_MEMALLOC.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/buffer.c     |    9 +++++----
 mm/page_alloc.c |    2 --
 mm/vmscan.c     |   15 +++++++++++++++
 3 files changed, 20 insertions(+), 6 deletions(-)

diff -puN fs/buffer.c~mm-cleanup-and-document-reclaim-recursion fs/buffer.c
--- a/fs/buffer.c~mm-cleanup-and-document-reclaim-recursion
+++ a/fs/buffer.c
@@ -411,13 +411,14 @@ static void free_more_memory(void)
 	wakeup_pdflush(1024);
 	yield();
 
+	/* We're already in reclaim */
+	if (current->flags & PF_MEMALLOC)
+		return;
+
 	for_each_online_pgdat(pgdat) {
 		zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones;
-		if (*zones && !(current->flags & PF_MEMALLOC)) {
-			current->flags |= PF_MEMALLOC;
+		if (*zones)
 			try_to_free_pages(zones, GFP_NOFS);
-			current->flags &= ~PF_MEMALLOC;
-		}
 	}
 }
 
diff -puN mm/page_alloc.c~mm-cleanup-and-document-reclaim-recursion mm/page_alloc.c
--- a/mm/page_alloc.c~mm-cleanup-and-document-reclaim-recursion
+++ a/mm/page_alloc.c
@@ -1210,14 +1210,12 @@ nofail_alloc:
 
 	/* We now go into synchronous reclaim */
 	cpuset_memory_pressure_bump();
-	p->flags |= PF_MEMALLOC;
 	reclaim_state.reclaimed_slab = 0;
 	p->reclaim_state = &reclaim_state;
 
 	did_some_progress = try_to_free_pages(zonelist->zones, gfp_mask);
 
 	p->reclaim_state = NULL;
-	p->flags &= ~PF_MEMALLOC;
 
 	cond_resched();
 
diff -puN mm/vmscan.c~mm-cleanup-and-document-reclaim-recursion mm/vmscan.c
--- a/mm/vmscan.c~mm-cleanup-and-document-reclaim-recursion
+++ a/mm/vmscan.c
@@ -1031,6 +1031,20 @@ unsigned long try_to_free_pages(struct z
 
 	count_vm_event(ALLOCSTALL);
 
+	/*
+	 * PF_MEMALLOC also keeps direct reclaim from recursing into itself.
+	 * Any invocation of direct reclaim with PF_MEMALLOC set is therefore
+	 * invalid.
+	 *
+	 * This makes sense, in that PF_MEMALLOC results in ALLOC_NO_WATERMARKS
+	 * for allocations (except __GFP_NOMEMALLOC), which only makes sense
+	 * for reclaim (or reclaim aiding) contexts. So starting reclaim
+	 * from a context that either helps out reclaim or is reclaim doesn't
+	 * make sense.
+	 */
+	WARN_ON(current->flags & PF_MEMALLOC);
+	current->flags |= PF_MEMALLOC;
+
 	for (i = 0; zones[i] != NULL; i++) {
 		struct zone *zone = zones[i];
 
@@ -1094,6 +1108,7 @@ out:
 
 		zone->prev_priority = priority;
 	}
+	current->flags &= ~PF_MEMALLOC;
 	return ret;
 }
 
_

Patches currently in -mm which might be from a.p.zijlstra@xxxxxxxxx are

git-net.patch
grab-swap-token-reordered.patch
new-scheme-to-preempt-swap-token.patch
new-scheme-to-preempt-swap-token-tidy.patch
mm-arch-do_page_fault-vs-in_atomic.patch
mm-pagefault_disableenable.patch
mm-pagefault_disableenable-s390-fix.patch
mm-kummap_atomic-vs-in_atomic.patch
mm-call-into-direct-reclaim-without-pf_memalloc-set.patch
mm-cleanup-and-document-reclaim-recursion.patch
lockdep-annotate-nfs-nfsd-in-kernel-sockets.patch
lockdep-annotate-nfs-nfsd-in-kernel-sockets-tidy.patch
lockdep-fix-ide-proc-interaction.patch
lockdep-spin_lock_irqsave_nested.patch
lockdep-spin_lock_irqsave_nested-fix.patch
lockdep-spin_lock_irqsave_nested-fix-2.patch
lockdep-annotate-bcsp-driver.patch
lockdep-print-current-locks-on-in_atomic-warnings.patch
lockdep-name-some-old-style-locks.patch
debug-workqueue-locking-sanity.patch
debug-workqueue-locking-sanity-fix.patch
tty-signal-tty-locking.patch
tty-signal-tty-locking-3270-fix.patch
do_task_stat-dont-take-tty_mutex.patch
do_acct_process-dont-take-tty_mutex.patch
sys_unshare-remove-a-broken-clone_sighand-code.patch
remove-the-old-bd_mutex-lockdep-annotation.patch
new-bd_mutex-lockdep-annotation.patch
remove-lock_key-approach-to-managing-nested-bd_mutex-locks.patch
simplify-some-aspects-of-bd_mutex-nesting.patch
use-mutex_lock_nested-for-bd_mutex-to-avoid-lockdep-warning.patch
avoid-lockdep-warning-in-md.patch
bdev-fix-bd_part_count-leak.patch
lockdep-annotate-nfsd4-recover-code.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux