lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 11 May 2012 14:05:01 +0530
From:	Aaditya Kumar <aaditya.kumar.30@...il.com>
To:	linux-kernel@...r.kernel.org, kosaki.motohiro@...il.com
Cc:	frank.rowand@...sony.com, tim.bird@...sony.com,
	takuzo.ohara@...sony.com, kan.iibuchi@...sony.com,
	kosaki.motohiro@...fujitsu.com
Subject: [RFC][PATCH] mm: Update zone->un_reclaimable in direct reclaim path

Dear All,

 Commit 929bea7c714220fc76ce3f75bef9056477c28e74 seems to have broken the
 OOM invocation during memory hot unplug in low memory conditions. This commit
 modifies the 'un-reclaimabilty check'  for  giving up trying to
reclaim pages in the
direct reclaim path and invoke OOM  killer to be based on zone->unreclaimable.

 While doing memory offline, if the memory to be off lined spans almost all the
 node then the memory needed to migrate pages for off lining can not
be allocated
 from the node that is being off lined as all pages are now in ISOLATED state
 (and also free).

 Since most pages are would be free due to pages having been migrated,
kswapd would
 not balance the zones as all zone watermarks would be OK and so
zone->un_reclaimable
 flag which is currently only set by kswapd will NOT be set.

 If page allocator has been passed the zones from above node(being
offlined) then
 OOM killer will never be invoked for low memory conditions because
buddy allocator
 will not allocate ISOLATED pages and direct reclaim path will not
give up trying
 because zone->unreclaimable flag would not be set for zone(s) in node
being off lined
 and thus resulting in a system hang.

The above issue is reproducible when off lining memory in low memory
conditions on ARM
systems for Cortex-A9, but the issue should be architecture independent.

This patch fixes this BUG by updating zone->unreclaimable in direct
reclaim path also.
---
  mm/vmscan.c |   11 	8 +	3 -	0 !
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: b/mm/vmscan.c
===================================================================
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1997,7 +1997,7 @@ restart:
  * scan then give up on it.
  */
 static void shrink_zones(int priority, struct zonelist *zonelist,
-					struct scan_control *sc)
+					struct scan_control *sc, int prev_nr_slab)
 {
 	struct zoneref *z;
 	struct zone *zone;
@@ -2033,6 +2033,8 @@ static void shrink_zones(int priority, s
 		}

 		shrink_zone(priority, zone, sc);
+		if (prev_nr_slab == 0 && !zone_reclaimable(zone))
+			zone->all_unreclaimable = 1;
 	}
 }

@@ -2091,6 +2093,7 @@ static unsigned long do_try_to_free_page
 	struct zoneref *z;
 	struct zone *zone;
 	unsigned long writeback_threshold;
+	int prev_nr_slab = 1;

 	get_mems_allowed();
 	delayacct_freepages_start();
@@ -2102,7 +2105,9 @@ static unsigned long do_try_to_free_page
 		sc->nr_scanned = 0;
 		if (!priority)
 			disable_swap_token(sc->mem_cgroup);
-		shrink_zones(priority, zonelist, sc);
+		shrink_zones(priority, zonelist, sc, prev_nr_slab);
+		prev_nr_slab = 1;
+
 		/*
 		 * Don't shrink slabs when reclaiming memory from
 		 * over limit cgroups
@@ -2117,7 +2122,7 @@ static unsigned long do_try_to_free_page
 				lru_pages += zone_reclaimable_pages(zone);
 			}

-			shrink_slab(shrink, sc->nr_scanned, lru_pages);
+			prev_nr_slab = shrink_slab(shrink, sc->nr_scanned, lru_pages);
 			if (reclaim_state) {
 				sc->nr_reclaimed += reclaim_state->reclaimed_slab;
 				reclaim_state->reclaimed_slab = 0;

Regards,
Aaditya Kumar.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ