Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1506186

Re: [PATCH v2 0/8] mm/swap: Regular page swap optimizations

From Tim Chen <tim.c.chen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 0/8] mm/swap: Regular page swap optimizations
Date 2016-10-21 19:50 +0200
Message-ID <suM77-oJ-3@gated-at.bofh.it> (permalink)
References <suv6h-5OV-3@gated-at.bofh.it> <suDdv-2Xg-11@gated-at.bofh.it> <suEVX-45D-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 21, 2016 at 12:05:19PM +0200, Christian Borntraeger wrote:
> On 10/21/2016 10:16 AM, Christian Borntraeger wrote:
> > [  308.206297] Call Trace:
> > [  308.206299] ([<000000000025d3ec>] __alloc_pages_nodemask+0x134/0xdf8)
> > [  308.206303] ([<0000000000280d6a>] kmalloc_order+0x42/0x70)
> > [  308.206305] ([<0000000000280dd8>] kmalloc_order_trace+0x40/0xf0)
> > [  308.206310] ([<00000000002a7090>] init_swap_address_space+0x68/0x138)
> > [  308.206312] ([<00000000002ac858>] SyS_swapon+0xbd0/0xf80)
> > [  308.206317] ([<0000000000785476>] system_call+0xd6/0x264)
> > [  308.206318] Last Breaking-Event-Address:
> > [  308.206319]  [<000000000025db38>] __alloc_pages_nodemask+0x880/0xdf8
> > [  308.206320] ---[ end trace aaeca736f47ac05b ]---
> > 
> 
> Looks like that 1TB of swap is just too big for your logic (you try kmalloc without checking the size).
> 

Thanks for giving this patch series a spin.
Let's use vzalloc instead.  Can you try the following change.

Thanks.

Tim

--->8---
diff --git a/mm/swap_state.c b/mm/swap_state.c
index af4ed5f..0f84526 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -526,11 +526,9 @@ int init_swap_address_space(unsigned int type, unsigned long nr_pages)
 	unsigned int i, nr;
 
 	nr = DIV_ROUND_UP(nr_pages, SWAP_ADDRESS_SPACE_PAGES);
-	spaces = kzalloc(sizeof(struct address_space) * nr, GFP_KERNEL);
+	spaces = vzalloc(sizeof(struct address_space) * nr);
 	if (!spaces) {
-		spaces = vzalloc(sizeof(struct address_space) * nr);
-		if (!spaces)
-			return -ENOMEM;
+		return -ENOMEM;
 	}
 	for (i = 0; i < nr; i++) {
 		space = spaces + i;

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/8] mm/swap: Regular page swap optimizations  Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  [PATCH v2 7/8] mm/swap: Add cache for swap slots allocation Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  [PATCH v2 8/8] mm/swap: Enable swap slots cache usage Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  [PATCH v2 6/8] mm/swap: Free swap slots in batch Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  [PATCH v2 4/8] mm/swap: skip read ahead for unreferenced swap slots Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  [PATCH v2 2/8] mm/swap: Add cluster lock Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
    Re: [PATCH v2 2/8] mm/swap: Add cluster lock Jonathan Corbet <corbet@lwn.net> - 2016-10-24 18:40 +0200
      Re: [PATCH v2 2/8] mm/swap: Add cluster lock "Huang\, Ying" <ying.huang@intel.com> - 2016-10-25 04:10 +0200
  [PATCH v2 1/8] mm/swap: Fix kernel message in swap_info_get() Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 01:40 +0200
  Re: [PATCH v2 0/8] mm/swap: Regular page swap optimizations Christian Borntraeger <borntraeger@de.ibm.com> - 2016-10-21 10:20 +0200
    Re: [PATCH v2 0/8] mm/swap: Regular page swap optimizations Christian Borntraeger <borntraeger@de.ibm.com> - 2016-10-21 12:10 +0200
      Re: [PATCH v2 0/8] mm/swap: Regular page swap optimizations Tim Chen <tim.c.chen@linux.intel.com> - 2016-10-21 19:50 +0200

csiph-web