Rafael Aquini 117aad1e9e mm: avoid reinserting isolated balloon pages into LRU lists
Isolated balloon pages can wrongly end up in LRU lists when
migrate_pages() finishes its round without draining all the isolated
page list.

The same issue can happen when reclaim_clean_pages_from_list() tries to
reclaim pages from an isolated page list, before migration, in the CMA
path.  Such balloon page leak opens a race window against LRU lists
shrinkers that leads us to the following kernel panic:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
  IP: [<ffffffff810c2625>] shrink_page_list+0x24e/0x897
  PGD 3cda2067 PUD 3d713067 PMD 0
  Oops: 0000 [#1] SMP
  CPU: 0 PID: 340 Comm: kswapd0 Not tainted 3.12.0-rc1-22626-g4367597 #87
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  RIP: shrink_page_list+0x24e/0x897
  RSP: 0000:ffff88003da499b8  EFLAGS: 00010286
  RAX: 0000000000000000 RBX: ffff88003e82bd60 RCX: 00000000000657d5
  RDX: 0000000000000000 RSI: 000000000000031f RDI: ffff88003e82bd40
  RBP: ffff88003da49ab0 R08: 0000000000000001 R09: 0000000081121a45
  R10: ffffffff81121a45 R11: ffff88003c4a9a28 R12: ffff88003e82bd40
  R13: ffff88003da0e800 R14: 0000000000000001 R15: ffff88003da49d58
  FS:  0000000000000000(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000067d9000 CR3: 000000003ace5000 CR4: 00000000000407b0
  Call Trace:
    shrink_inactive_list+0x240/0x3de
    shrink_lruvec+0x3e0/0x566
    __shrink_zone+0x94/0x178
    shrink_zone+0x3a/0x82
    balance_pgdat+0x32a/0x4c2
    kswapd+0x2f0/0x372
    kthread+0xa2/0xaa
    ret_from_fork+0x7c/0xb0
  Code: 80 7d 8f 01 48 83 95 68 ff ff ff 00 4c 89 e7 e8 5a 7b 00 00 48 85 c0 49 89 c5 75 08 80 7d 8f 00 74 3e eb 31 48 8b 80 18 01 00 00 <48> 8b 74 0d 48 8b 78 30 be 02 00 00 00 ff d2 eb
  RIP  [<ffffffff810c2625>] shrink_page_list+0x24e/0x897
   RSP <ffff88003da499b8>
  CR2: 0000000000000028
  ---[ end trace 703d2451af6ffbfd ]---
  Kernel panic - not syncing: Fatal exception

This patch fixes the issue, by assuring the proper tests are made at
putback_movable_pages() & reclaim_clean_pages_from_list() to avoid
isolated balloon pages being wrongly reinserted in LRU lists.

[akpm@linux-foundation.org: clarify awkward comment text]
Signed-off-by: Rafael Aquini <aquini@redhat.com>
Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Rik van Riel <riel@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-30 14:31:02 -07:00
..
2013-08-26 14:09:03 -04:00
2013-08-14 13:55:15 +05:30
2013-03-01 13:39:00 -08:00
2013-09-06 13:21:16 -07:00
2013-09-09 16:35:29 -07:00
2013-09-10 13:33:09 -07:00
2013-09-10 13:03:41 -07:00
2013-09-10 13:33:09 -07:00
2013-06-17 14:38:54 -04:00
2013-07-03 16:31:35 -07:00
2013-07-30 11:53:12 -04:00
2013-05-29 15:50:34 -04:00
2013-07-03 16:07:39 -07:00
2013-08-26 18:40:56 -04:00
2013-08-27 01:44:40 +02:00
2013-03-12 11:30:04 -07:00
2013-05-01 16:36:22 +05:30
2013-07-23 16:01:28 -07:00
2013-02-26 02:46:08 -05:00
2013-07-15 11:25:00 +09:30
2013-05-07 18:38:27 -07:00
2013-03-15 15:09:43 +10:30
2013-04-29 18:28:40 -07:00
2013-08-26 20:15:23 +09:00
2013-06-17 16:38:57 -07:00
2013-08-22 22:13:54 -07:00
2013-09-13 23:06:40 -04:00
2013-06-19 23:32:07 -04:00
2013-09-13 15:09:52 +02:00
2013-01-25 21:03:54 -08:00
2013-08-23 10:22:29 +02:00
2013-06-13 17:51:04 -07:00
2013-07-18 13:05:23 -07:00
2013-08-22 20:30:15 -07:00
2013-09-11 15:59:42 -07:00
2013-06-17 16:38:57 -07:00
2013-09-13 15:09:52 +02:00
2013-09-13 15:09:52 +02:00
2013-09-13 15:09:52 +02:00
2013-08-09 10:49:00 +02:00
2013-07-26 16:19:48 -07:00
2013-04-30 17:04:06 -07:00
2013-08-28 21:35:14 -07:00
2013-04-01 11:04:50 -07:00
2013-07-16 22:00:14 -07:00
2013-05-31 00:48:22 -07:00
2013-08-12 15:27:01 +00:00
2013-09-08 20:20:23 -04:00
2013-07-03 16:08:05 -07:00
2013-09-15 22:18:13 -04:00
2013-06-08 16:20:14 -04:00
2012-12-11 17:22:27 -08:00
2013-05-04 14:47:26 -04:00
2013-09-03 16:40:32 -04:00
2013-09-10 13:53:52 -07:00
2013-09-24 21:12:32 -05:00
2013-08-12 15:27:01 +00:00
2013-06-12 12:37:30 +01:00
2013-09-10 13:53:52 -07:00
2013-04-29 15:54:28 -07:00
2013-09-15 17:41:30 -04:00
2013-09-06 13:30:06 -07:00
2013-09-09 14:29:15 -07:00
2013-05-31 17:19:05 -07:00
2013-03-19 09:47:30 +01:00
2013-06-21 11:32:51 +02:00
2013-09-03 10:07:40 -07:00
2013-04-12 10:26:23 +02:00
2013-07-03 16:08:05 -07:00
2013-06-17 16:38:57 -07:00
2013-06-17 18:09:53 +09:00
2013-09-10 18:56:32 -04:00
2013-09-04 23:11:42 +03:00
2013-04-30 15:50:12 +05:30
2013-09-12 15:38:02 -07:00
2013-05-21 12:25:02 -05:00
2013-07-24 15:12:53 -07:00
2013-03-20 12:10:38 -04:00
2013-08-05 10:52:36 -06:00
2013-05-27 10:57:53 +09:00
2013-07-10 18:11:34 -07:00