From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx128.postini.com [74.125.245.128]) by kanga.kvack.org (Postfix) with SMTP id C0E386B0008 for ; Thu, 24 Jan 2013 22:47:03 -0500 (EST) Message-ID: <5101FFF5.6030503@oracle.com> Date: Thu, 24 Jan 2013 22:45:57 -0500 From: Sasha Levin MIME-Version: 1.0 Subject: boot warnings due to swap: make each swap partition have one address_space Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton , Shaohua Li Cc: Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" Hi folks, Commit "swap: make each swap partition have one address_space" is triggering a series of warnings on boot: [ 3.446071] ------------[ cut here ]------------ [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) [ 3.450360] Modules linked in: [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 [ 3.454508] Call Trace: [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 [ 3.455248] [] debug_print_object+0x8e/0xb0 [ 3.455248] [] __debug_object_init+0x20b/0x290 [ 3.455248] [] debug_object_init+0x15/0x20 [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 [ 3.455248] [] bdi_init+0x1ac/0x270 [ 3.455248] [] swap_setup+0x3b/0x87 [ 3.455248] [] ? swap_setup+0x87/0x87 [ 3.455248] [] kswapd_init+0x11/0x7c [ 3.455248] [] do_one_initcall+0x8a/0x180 [ 3.455248] [] do_basic_setup+0x96/0xb4 [ 3.455248] [] ? loglevel+0x31/0x31 [ 3.455248] [] ? sched_init_smp+0x150/0x157 [ 3.455248] [] kernel_init_freeable+0xd2/0x14c [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] [] kernel_init+0x9/0xf0 [ 3.455248] [] ret_from_fork+0x7c/0xb0 [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- I haven't looked deeper into it yet, and will do so tomorrow, unless this spew is obvious to anyone. Thanks, Sasha -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx133.postini.com [74.125.245.133]) by kanga.kvack.org (Postfix) with SMTP id D85CF6B0005 for ; Thu, 24 Jan 2013 23:25:37 -0500 (EST) Received: by mail-pa0-f52.google.com with SMTP id fb1so10960pad.39 for ; Thu, 24 Jan 2013 20:25:37 -0800 (PST) Date: Fri, 25 Jan 2013 12:25:12 +0800 From: Shaohua Li Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130125042512.GA32017@kernel.org> References: <5101FFF5.6030503@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5101FFF5.6030503@oracle.com> Sender: owner-linux-mm@kvack.org List-ID: To: Sasha Levin Cc: Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > Hi folks, > > Commit "swap: make each swap partition have one address_space" is triggering > a series of warnings on boot: > > [ 3.446071] ------------[ cut here ]------------ > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > [ 3.450360] Modules linked in: > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > [ 3.454508] Call Trace: > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > [ 3.455248] [] debug_print_object+0x8e/0xb0 > [ 3.455248] [] __debug_object_init+0x20b/0x290 > [ 3.455248] [] debug_object_init+0x15/0x20 > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > [ 3.455248] [] bdi_init+0x1ac/0x270 > [ 3.455248] [] swap_setup+0x3b/0x87 > [ 3.455248] [] ? swap_setup+0x87/0x87 > [ 3.455248] [] kswapd_init+0x11/0x7c > [ 3.455248] [] do_one_initcall+0x8a/0x180 > [ 3.455248] [] do_basic_setup+0x96/0xb4 > [ 3.455248] [] ? loglevel+0x31/0x31 > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] [] kernel_init+0x9/0xf0 > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > spew is obvious to anyone. Does this one help? Subject: give-each-swapper-space-separate-backing_dev_info The backing_dev_info can't be shared by all swapper address space. Reported-by: Sasha Levin Signed-off-by: Shaohua Li --- mm/swap.c | 1 + mm/swap_state.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) Index: linux/mm/swap.c =================================================================== --- linux.orig/mm/swap.c 2013-01-22 10:11:58.310933234 +0800 +++ linux/mm/swap.c 2013-01-25 12:14:49.524863610 +0800 @@ -859,6 +859,7 @@ void __init swap_setup(void) int i; for (i = 0; i < MAX_SWAPFILES; i++) { + swapper_spaces[i].backing_dev_info += i; bdi_init(swapper_spaces[i].backing_dev_info); spin_lock_init(&swapper_spaces[i].tree_lock); INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); Index: linux/mm/swap_state.c =================================================================== --- linux.orig/mm/swap_state.c 2013-01-24 18:08:05.149390977 +0800 +++ linux/mm/swap_state.c 2013-01-25 12:14:12.849323671 +0800 @@ -31,16 +31,19 @@ static const struct address_space_operat .migratepage = migrate_page, }; -static struct backing_dev_info swap_backing_dev_info = { - .name = "swap", - .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_SWAP_BACKED, +static struct backing_dev_info swap_backing_dev_info[MAX_SWAPFILES] = { + [0 ... MAX_SWAPFILES - 1] = { + .name = "swap", + .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | + BDI_CAP_SWAP_BACKED, + } }; struct address_space swapper_spaces[MAX_SWAPFILES] = { [0 ... MAX_SWAPFILES - 1] = { .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), .a_ops = &swap_aops, - .backing_dev_info = &swap_backing_dev_info, + .backing_dev_info = &swap_backing_dev_info[0], } }; -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx176.postini.com [74.125.245.176]) by kanga.kvack.org (Postfix) with SMTP id 991416B0005 for ; Fri, 25 Jan 2013 18:37:36 -0500 (EST) Message-ID: <51031738.4060102@oracle.com> Date: Fri, 25 Jan 2013 18:37:28 -0500 From: Sasha Levin MIME-Version: 1.0 Subject: Re: boot warnings due to swap: make each swap partition have one address_space References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> In-Reply-To: <20130125042512.GA32017@kernel.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Shaohua Li Cc: Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" On 01/24/2013 11:25 PM, Shaohua Li wrote: > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: >> Hi folks, >> >> Commit "swap: make each swap partition have one address_space" is triggering >> a series of warnings on boot: >> >> [ 3.446071] ------------[ cut here ]------------ >> [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() >> [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) >> [ 3.450360] Modules linked in: >> [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 >> [ 3.454508] Call Trace: >> [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 >> [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 >> [ 3.455248] [] debug_print_object+0x8e/0xb0 >> [ 3.455248] [] __debug_object_init+0x20b/0x290 >> [ 3.455248] [] debug_object_init+0x15/0x20 >> [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 >> [ 3.455248] [] bdi_init+0x1ac/0x270 >> [ 3.455248] [] swap_setup+0x3b/0x87 >> [ 3.455248] [] ? swap_setup+0x87/0x87 >> [ 3.455248] [] kswapd_init+0x11/0x7c >> [ 3.455248] [] do_one_initcall+0x8a/0x180 >> [ 3.455248] [] do_basic_setup+0x96/0xb4 >> [ 3.455248] [] ? loglevel+0x31/0x31 >> [ 3.455248] [] ? sched_init_smp+0x150/0x157 >> [ 3.455248] [] kernel_init_freeable+0xd2/0x14c >> [ 3.455248] [] ? rest_init+0x140/0x140 >> [ 3.455248] [] kernel_init+0x9/0xf0 >> [ 3.455248] [] ret_from_fork+0x7c/0xb0 >> [ 3.455248] [] ? rest_init+0x140/0x140 >> [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- >> >> I haven't looked deeper into it yet, and will do so tomorrow, unless this >> spew is obvious to anyone. > > Does this one help? [snip] Yup, it did. Thanks! Thanks, Sasha -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx187.postini.com [74.125.245.187]) by kanga.kvack.org (Postfix) with SMTP id B81256B0005 for ; Sat, 26 Jan 2013 21:16:10 -0500 (EST) Received: by mail-pb0-f47.google.com with SMTP id rp8so94251pbb.34 for ; Sat, 26 Jan 2013 18:16:10 -0800 (PST) Date: Sat, 26 Jan 2013 18:16:05 -0800 (PST) From: Hugh Dickins Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130125042512.GA32017@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Shaohua Li Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Fri, 25 Jan 2013, Shaohua Li wrote: > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > Hi folks, > > > > Commit "swap: make each swap partition have one address_space" is triggering > > a series of warnings on boot: > > > > [ 3.446071] ------------[ cut here ]------------ > > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > > [ 3.450360] Modules linked in: > > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > > [ 3.454508] Call Trace: > > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > > [ 3.455248] [] debug_print_object+0x8e/0xb0 > > [ 3.455248] [] __debug_object_init+0x20b/0x290 > > [ 3.455248] [] debug_object_init+0x15/0x20 > > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > > [ 3.455248] [] bdi_init+0x1ac/0x270 > > [ 3.455248] [] swap_setup+0x3b/0x87 > > [ 3.455248] [] ? swap_setup+0x87/0x87 > > [ 3.455248] [] kswapd_init+0x11/0x7c > > [ 3.455248] [] do_one_initcall+0x8a/0x180 > > [ 3.455248] [] do_basic_setup+0x96/0xb4 > > [ 3.455248] [] ? loglevel+0x31/0x31 > > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > > [ 3.455248] [] ? rest_init+0x140/0x140 > > [ 3.455248] [] kernel_init+0x9/0xf0 > > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > > [ 3.455248] [] ? rest_init+0x140/0x140 > > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > > spew is obvious to anyone. > > Does this one help? > > Subject: give-each-swapper-space-separate-backing_dev_info > > The backing_dev_info can't be shared by all swapper address space. Whyever not? It's perfectly normal for different inodes/address_spaces to share a single backing_dev! Sasha's trace says that it's wrong to initialize it MAX_SWAPFILES times: fair enough. But why should I now want to spend 32kB (not even counting their __percpu counters) on all these pseudo-backing_devs? Hugh p.s. a grand little change would be to move page_cluster and swap_setup() from mm/swap.c to mm/swap_state.c: they have nothing to do with the other contents of swap.c, and everything to do with the contents of swap_state.c. Why swap.c is called swap.c is rather a mystery. > > Reported-by: Sasha Levin > Signed-off-by: Shaohua Li > --- > mm/swap.c | 1 + > mm/swap_state.c | 11 +++++++---- > 2 files changed, 8 insertions(+), 4 deletions(-) > > Index: linux/mm/swap.c > =================================================================== > --- linux.orig/mm/swap.c 2013-01-22 10:11:58.310933234 +0800 > +++ linux/mm/swap.c 2013-01-25 12:14:49.524863610 +0800 > @@ -859,6 +859,7 @@ void __init swap_setup(void) > int i; > > for (i = 0; i < MAX_SWAPFILES; i++) { > + swapper_spaces[i].backing_dev_info += i; > bdi_init(swapper_spaces[i].backing_dev_info); > spin_lock_init(&swapper_spaces[i].tree_lock); > INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); > Index: linux/mm/swap_state.c > =================================================================== > --- linux.orig/mm/swap_state.c 2013-01-24 18:08:05.149390977 +0800 > +++ linux/mm/swap_state.c 2013-01-25 12:14:12.849323671 +0800 > @@ -31,16 +31,19 @@ static const struct address_space_operat > .migratepage = migrate_page, > }; > > -static struct backing_dev_info swap_backing_dev_info = { > - .name = "swap", > - .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_SWAP_BACKED, > +static struct backing_dev_info swap_backing_dev_info[MAX_SWAPFILES] = { > + [0 ... MAX_SWAPFILES - 1] = { > + .name = "swap", > + .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | > + BDI_CAP_SWAP_BACKED, > + } > }; > > struct address_space swapper_spaces[MAX_SWAPFILES] = { > [0 ... MAX_SWAPFILES - 1] = { > .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), > .a_ops = &swap_aops, > - .backing_dev_info = &swap_backing_dev_info, > + .backing_dev_info = &swap_backing_dev_info[0], > } > }; > > -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx116.postini.com [74.125.245.116]) by kanga.kvack.org (Postfix) with SMTP id 4F6AC6B0005 for ; Sun, 27 Jan 2013 09:13:13 -0500 (EST) Received: by mail-pb0-f51.google.com with SMTP id un15so17462pbc.24 for ; Sun, 27 Jan 2013 06:13:12 -0800 (PST) Date: Sun, 27 Jan 2013 22:12:53 +0800 From: Shaohua Li Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130127141253.GA27019@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > On Fri, 25 Jan 2013, Shaohua Li wrote: > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > Hi folks, > > > > > > Commit "swap: make each swap partition have one address_space" is triggering > > > a series of warnings on boot: > > > > > > [ 3.446071] ------------[ cut here ]------------ > > > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > > > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > > > [ 3.450360] Modules linked in: > > > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > > > [ 3.454508] Call Trace: > > > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > > > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > > > [ 3.455248] [] debug_print_object+0x8e/0xb0 > > > [ 3.455248] [] __debug_object_init+0x20b/0x290 > > > [ 3.455248] [] debug_object_init+0x15/0x20 > > > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > > > [ 3.455248] [] bdi_init+0x1ac/0x270 > > > [ 3.455248] [] swap_setup+0x3b/0x87 > > > [ 3.455248] [] ? swap_setup+0x87/0x87 > > > [ 3.455248] [] kswapd_init+0x11/0x7c > > > [ 3.455248] [] do_one_initcall+0x8a/0x180 > > > [ 3.455248] [] do_basic_setup+0x96/0xb4 > > > [ 3.455248] [] ? loglevel+0x31/0x31 > > > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > > > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > > > [ 3.455248] [] ? rest_init+0x140/0x140 > > > [ 3.455248] [] kernel_init+0x9/0xf0 > > > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > > > [ 3.455248] [] ? rest_init+0x140/0x140 > > > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > > > > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > > > spew is obvious to anyone. > > > > Does this one help? > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > The backing_dev_info can't be shared by all swapper address space. > > Whyever not? It's perfectly normal for different inodes/address_spaces > to share a single backing_dev! Sasha's trace says that it's wrong to > initialize it MAX_SWAPFILES times: fair enough. But why should I now > want to spend 32kB (not even counting their __percpu counters) on all > these pseudo-backing_devs? That's correct, silly me. Updated it. > > p.s. a grand little change would be to move page_cluster and swap_setup() > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > contents of swap.c, and everything to do with the contents of swap_state.c. > Why swap.c is called swap.c is rather a mystery. Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will make it optional. don't want to add another #ifdef, so give up. Subject: init-swap-space-backing-dev-info-once Sasha reported: Commit "swap: make each swap partition have one address_space" is triggering a series of warnings on boot: [ 3.446071] ------------[ cut here ]------------ [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) [ 3.450360] Modules linked in: [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 [ 3.454508] Call Trace: [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 [ 3.455248] [] debug_print_object+0x8e/0xb0 [ 3.455248] [] __debug_object_init+0x20b/0x290 [ 3.455248] [] debug_object_init+0x15/0x20 [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 [ 3.455248] [] bdi_init+0x1ac/0x270 [ 3.455248] [] swap_setup+0x3b/0x87 [ 3.455248] [] ? swap_setup+0x87/0x87 [ 3.455248] [] kswapd_init+0x11/0x7c [ 3.455248] [] do_one_initcall+0x8a/0x180 [ 3.455248] [] do_basic_setup+0x96/0xb4 [ 3.455248] [] ? loglevel+0x31/0x31 [ 3.455248] [] ? sched_init_smp+0x150/0x157 [ 3.455248] [] kernel_init_freeable+0xd2/0x14c [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] [] kernel_init+0x9/0xf0 [ 3.455248] [] ret_from_fork+0x7c/0xb0 [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- Initialize swap space backing_dev_info once to avoid the warning. Reported-by: Sasha Levin Signed-off-by: Shaohua Li --- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/mm/swap.c =================================================================== --- linux.orig/mm/swap.c 2013-01-27 21:26:21.942696713 +0800 +++ linux/mm/swap.c 2013-01-27 21:27:29.233865394 +0800 @@ -858,8 +858,8 @@ void __init swap_setup(void) #ifdef CONFIG_SWAP int i; + bdi_init(swapper_spaces[0].backing_dev_info); for (i = 0; i < MAX_SWAPFILES; i++) { - bdi_init(swapper_spaces[i].backing_dev_info); spin_lock_init(&swapper_spaces[i].tree_lock); INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); } -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx203.postini.com [74.125.245.203]) by kanga.kvack.org (Postfix) with SMTP id 608006B0007 for ; Sun, 27 Jan 2013 16:40:40 -0500 (EST) Received: by mail-da0-f48.google.com with SMTP id k18so941637dae.21 for ; Sun, 27 Jan 2013 13:40:39 -0800 (PST) Date: Sun, 27 Jan 2013 13:40:40 -0800 (PST) From: Hugh Dickins Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130127141253.GA27019@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Shaohua Li Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Sun, 27 Jan 2013, Shaohua Li wrote: > On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > > On Fri, 25 Jan 2013, Shaohua Li wrote: > > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > > > The backing_dev_info can't be shared by all swapper address space. > > > > Whyever not? It's perfectly normal for different inodes/address_spaces > > to share a single backing_dev! Sasha's trace says that it's wrong to > > initialize it MAX_SWAPFILES times: fair enough. But why should I now > > want to spend 32kB (not even counting their __percpu counters) on all > > these pseudo-backing_devs? > > That's correct, silly me. Updated it. Looks much more to my taste, thank you! > > > > p.s. a grand little change would be to move page_cluster and swap_setup() > > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > > contents of swap.c, and everything to do with the contents of swap_state.c. > > Why swap.c is called swap.c is rather a mystery. > > Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will > make it optional. don't want to add another #ifdef, so give up. Good point, thanks for trying, maybe I'll attack it next time it irritates me. I don't yet know whether I approve of your changes or not, but running with them to see (and I'll send another bugfix separately in a moment). I was the one who removed the swap_device_lock() which 2.4 used, because it almost always ended up having to take both swap_list_lock() and swap_device_lock(si). You seem to have done a much better job of separating them usefully, but I need to convince myself that it does end up safely. My reservations so far would be: how many installations actually have more than one swap area, so is it a good tradeoff to add more overhead to help those at the (slight) expense of everyone else? The increasingly ugly page_mapping() worries me, and the static array of swapper_spaces annoys me a little. I'm glad Minchan has now pointed you to Rik's posting of two years ago: I think there are more important changes to be made in that direction. Hugh > > > Subject: init-swap-space-backing-dev-info-once > > > Sasha reported: > Commit "swap: make each swap partition have one address_space" is triggering > a series of warnings on boot: > > [ 3.446071] ------------[ cut here ]------------ > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > [ 3.450360] Modules linked in: > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > [ 3.454508] Call Trace: > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > [ 3.455248] [] debug_print_object+0x8e/0xb0 > [ 3.455248] [] __debug_object_init+0x20b/0x290 > [ 3.455248] [] debug_object_init+0x15/0x20 > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > [ 3.455248] [] bdi_init+0x1ac/0x270 > [ 3.455248] [] swap_setup+0x3b/0x87 > [ 3.455248] [] ? swap_setup+0x87/0x87 > [ 3.455248] [] kswapd_init+0x11/0x7c > [ 3.455248] [] do_one_initcall+0x8a/0x180 > [ 3.455248] [] do_basic_setup+0x96/0xb4 > [ 3.455248] [] ? loglevel+0x31/0x31 > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] [] kernel_init+0x9/0xf0 > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > Initialize swap space backing_dev_info once to avoid the warning. > > Reported-by: Sasha Levin > Signed-off-by: Shaohua Li > --- > mm/swap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux/mm/swap.c > =================================================================== > --- linux.orig/mm/swap.c 2013-01-27 21:26:21.942696713 +0800 > +++ linux/mm/swap.c 2013-01-27 21:27:29.233865394 +0800 > @@ -858,8 +858,8 @@ void __init swap_setup(void) > #ifdef CONFIG_SWAP > int i; > > + bdi_init(swapper_spaces[0].backing_dev_info); > for (i = 0; i < MAX_SWAPFILES; i++) { > - bdi_init(swapper_spaces[i].backing_dev_info); > spin_lock_init(&swapper_spaces[i].tree_lock); > INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); > } > -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx159.postini.com [74.125.245.159]) by kanga.kvack.org (Postfix) with SMTP id 445646B0007 for ; Sun, 27 Jan 2013 16:47:01 -0500 (EST) Received: by mail-pa0-f53.google.com with SMTP id hz1so1140385pad.40 for ; Sun, 27 Jan 2013 13:47:00 -0800 (PST) Date: Sun, 27 Jan 2013 13:47:01 -0800 (PST) From: Hugh Dickins Subject: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix In-Reply-To: <20130127141253.GA27019@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Shaohua Li Cc: Andrew Morton , Sasha Levin , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org I had all cpus spinning in swap_info_get(), for the lock on an area being swapped off: probably because get_swap_page() forgot to unlock. Signed-off-by: Hugh Dickins --- mm/swapfile.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- mmotm.orig/mm/swapfile.c 2013-01-23 17:55:39.132447115 -0800 +++ mmotm/mm/swapfile.c 2013-01-27 10:41:45.000000000 -0800 @@ -470,10 +470,9 @@ swp_entry_t get_swap_page(void) spin_unlock(&swap_lock); /* This is called for allocating swap entry for cache */ offset = scan_swap_map(si, SWAP_HAS_CACHE); - if (offset) { - spin_unlock(&si->lock); + spin_unlock(&si->lock); + if (offset) return swp_entry(type, offset); - } spin_lock(&swap_lock); next = swap_list.next; } -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx149.postini.com [74.125.245.149]) by kanga.kvack.org (Postfix) with SMTP id 435CE6B0007 for ; Sun, 27 Jan 2013 19:07:25 -0500 (EST) Received: by mail-da0-f54.google.com with SMTP id n2so963518dad.13 for ; Sun, 27 Jan 2013 16:07:24 -0800 (PST) Date: Mon, 28 Jan 2013 08:07:05 +0800 From: Shaohua Li Subject: Re: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix Message-ID: <20130128000705.GA1306@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Andrew Morton , Sasha Levin , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Sun, Jan 27, 2013 at 01:47:01PM -0800, Hugh Dickins wrote: > I had all cpus spinning in swap_info_get(), for the lock on an area > being swapped off: probably because get_swap_page() forgot to unlock. > > Signed-off-by: Hugh Dickins Good catch. Thanks! > --- > > mm/swapfile.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > --- mmotm.orig/mm/swapfile.c 2013-01-23 17:55:39.132447115 -0800 > +++ mmotm/mm/swapfile.c 2013-01-27 10:41:45.000000000 -0800 > @@ -470,10 +470,9 @@ swp_entry_t get_swap_page(void) > spin_unlock(&swap_lock); > /* This is called for allocating swap entry for cache */ > offset = scan_swap_map(si, SWAP_HAS_CACHE); > - if (offset) { > - spin_unlock(&si->lock); > + spin_unlock(&si->lock); > + if (offset) > return swp_entry(type, offset); > - } > spin_lock(&swap_lock); > next = swap_list.next; > } -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx111.postini.com [74.125.245.111]) by kanga.kvack.org (Postfix) with SMTP id C61BD6B009A for ; Tue, 29 Jan 2013 10:58:59 -0500 (EST) Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: Your message of "Sun, 27 Jan 2013 13:40:40 -0800." From: Valdis.Kletnieks@vt.edu References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==_Exmh_1359474972_2191P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Date: Tue, 29 Jan 2013 10:56:12 -0500 Message-ID: <10359.1359474972@turing-police.cc.vt.edu> Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Shaohua Li , Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org --==_Exmh_1359474972_2191P Content-Type: text/plain; charset=us-ascii On Sun, 27 Jan 2013 13:40:40 -0800, Hugh Dickins said: > My reservations so far would be: how many installations actually have > more than one swap area, so is it a good tradeoff to add more overhead > to help those at the (slight) expense of everyone else? The increasingly > ugly page_mapping() worries me, and the static array of swapper_spaces > annoys me a little. Right now, probably few. But the number may go up a lot if the whole 'zram-for-swapspace' thing catches on and/or ships in a distro... --==_Exmh_1359474972_2191P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Exmh version 2.5 07/13/2001 iQIVAwUBUQfxHAdmEQWDXROgAQIxbw/+N1MQpUPq+NXQQZTBK1tTvYXz4zDp5GCe yZ6kUMCOI/z/gAJhU9F8cyUQytu2LOk6cCbMOvceIulVBMVUdvVzWxz9UmIS/fXC 85qbulgXIGiCh5hOemqq5LhRzlOws9uX/0HOIUZVQOKBGa8gWSs+qHXwwwtpcDm0 VGLjqmY3dSGp0KWt46FPCm0ddg60uIQfEANFr/fyZTuxE2HoZHs5oADLI0c9nx9Q pEcEBypJPSoqXrPToQhO+y23+y4Dwo75z4iw91d9FyUt6+SQ2Ki4c6UU+z9mvUEB QHvlRXnq9jQvFOfy02ivYJW5EiUxH7L0D36LMDCQ4lCMyCfBTdOF2Sfr+pyV0hop Z/cVe0IgXph1K1QsKA6X74NUWbrg77EvN9QAdxjHCOKXTymqhpJR+p3pMl/3D1fa toi7sBYqXsVt+8ydpt0LsszIJTZvOLaTFf5FwkN76+U4DWbeJUIV9yaTwsiGdO1d /ZgEn1U3GExA/UjDiNGmgUEOI65Bgx1nm2qgf7TVFL77BJQyN/2M3MJzcE2tAwbW zija8wt7/81mUAxxTNSN6WsjFnEQ0FvUJ6+Gn3i6ThuDEJyGebxucxql/Vp6DvCH RXdDSoUypaUGCy0Km+VtF5t2317Bofi99+Kq8RKLcCHse9z1pjHzrKjAlDkW3ExH FPc5J5cI9OI= =Ll4n -----END PGP SIGNATURE----- --==_Exmh_1359474972_2191P-- -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx170.postini.com [74.125.245.170]) by kanga.kvack.org (Postfix) with SMTP id 4C60E6B0005 for ; Wed, 30 Jan 2013 05:00:52 -0500 (EST) Received: by mail-da0-f42.google.com with SMTP id z17so703275dal.1 for ; Wed, 30 Jan 2013 02:00:51 -0800 (PST) Date: Wed, 30 Jan 2013 17:59:44 +0800 From: Shaohua Li Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130130095944.GA11457@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Sun, Jan 27, 2013 at 01:40:40PM -0800, Hugh Dickins wrote: > On Sun, 27 Jan 2013, Shaohua Li wrote: > > On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > > > On Fri, 25 Jan 2013, Shaohua Li wrote: > > > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > > > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > > > > > The backing_dev_info can't be shared by all swapper address space. > > > > > > Whyever not? It's perfectly normal for different inodes/address_spaces > > > to share a single backing_dev! Sasha's trace says that it's wrong to > > > initialize it MAX_SWAPFILES times: fair enough. But why should I now > > > want to spend 32kB (not even counting their __percpu counters) on all > > > these pseudo-backing_devs? > > > > That's correct, silly me. Updated it. > > Looks much more to my taste, thank you! > > > > > > > p.s. a grand little change would be to move page_cluster and swap_setup() > > > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > > > contents of swap.c, and everything to do with the contents of swap_state.c. > > > Why swap.c is called swap.c is rather a mystery. > > > > Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will > > make it optional. don't want to add another #ifdef, so give up. > > Good point, thanks for trying, maybe I'll attack it next time it > irritates me. > > I don't yet know whether I approve of your changes or not, but running > with them to see (and I'll send another bugfix separately in a moment). > > I was the one who removed the swap_device_lock() which 2.4 used, > because it almost always ended up having to take both swap_list_lock() > and swap_device_lock(si). You seem to have done a much better job of > separating them usefully, but I need to convince myself that it does > end up safely. > > My reservations so far would be: how many installations actually have > more than one swap area, so is it a good tradeoff to add more overhead > to help those at the (slight) expense of everyone else? The increasingly > ugly page_mapping() worries me, and the static array of swapper_spaces > annoys me a little. > > I'm glad Minchan has now pointed you to Rik's posting of two years ago: > I think there are more important changes to be made in that direction. Not sure how others use multiple swaps, but current lock contention forces us to use multiple swaps. I haven't carefully think about Rik's posting, but looks it doesn't solve the lock contention problem. Thanks, Shaohua -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx125.postini.com [74.125.245.125]) by kanga.kvack.org (Postfix) with SMTP id AB5A36B0005 for ; Mon, 4 Feb 2013 00:12:00 -0500 (EST) Received: by mail-da0-f46.google.com with SMTP id p5so2480699dak.5 for ; Sun, 03 Feb 2013 21:11:59 -0800 (PST) Date: Sun, 3 Feb 2013 21:12:05 -0800 (PST) From: Hugh Dickins Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130130095944.GA11457@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> <20130130095944.GA11457@kernel.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Shaohua Li Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Wed, 30 Jan 2013, Shaohua Li wrote: > On Sun, Jan 27, 2013 at 01:40:40PM -0800, Hugh Dickins wrote: > > > > I'm glad Minchan has now pointed you to Rik's posting of two years ago: > > I think there are more important changes to be made in that direction. > > Not sure how others use multiple swaps, but current lock contention forces us > to use multiple swaps. I haven't carefully think about Rik's posting, but looks > it doesn't solve the lock contention problem. Nobody had reported any swap lock contention problem before your patch, so no, Rik's posting wasn't directed at that. I always thought swap writing patterns a much bigger problem. But if lock contention there is, then I think it can be implemented with reducing that in mind. There are two levels of allocation: one to allocate the tokens which we will insert in page tables, and one to allocate the final diskspace to which those tokens will point. (I may be using totally different language from Rik, it's the principles that I have in mind, not his actual posting.) Allocating the tokens can very well be done with per-cpu batches, perhaps of SWAP_CLUSTER_MAX 32 to match vmscan.c's batching: there is no significance to their ordering. And allocating the diskspace would want to be done in batches, to maximize contiguous writing. That may not solve all the swap_info_get() contention which you saw, but should help some. I'm thinking that we go with your per-swapper-space locking for now; but I wouldn't mind taking it out again later, if we arrive at a better solution which benefits even those with a single swap area. Hugh -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755149Ab3AYDrI (ORCPT ); Thu, 24 Jan 2013 22:47:08 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:50625 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754519Ab3AYDrG (ORCPT ); Thu, 24 Jan 2013 22:47:06 -0500 Message-ID: <5101FFF5.6030503@oracle.com> Date: Thu, 24 Jan 2013 22:45:57 -0500 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130113 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andrew Morton , Shaohua Li CC: Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" Subject: boot warnings due to swap: make each swap partition have one address_space Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi folks, Commit "swap: make each swap partition have one address_space" is triggering a series of warnings on boot: [ 3.446071] ------------[ cut here ]------------ [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) [ 3.450360] Modules linked in: [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 [ 3.454508] Call Trace: [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 [ 3.455248] [] debug_print_object+0x8e/0xb0 [ 3.455248] [] __debug_object_init+0x20b/0x290 [ 3.455248] [] debug_object_init+0x15/0x20 [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 [ 3.455248] [] bdi_init+0x1ac/0x270 [ 3.455248] [] swap_setup+0x3b/0x87 [ 3.455248] [] ? swap_setup+0x87/0x87 [ 3.455248] [] kswapd_init+0x11/0x7c [ 3.455248] [] do_one_initcall+0x8a/0x180 [ 3.455248] [] do_basic_setup+0x96/0xb4 [ 3.455248] [] ? loglevel+0x31/0x31 [ 3.455248] [] ? sched_init_smp+0x150/0x157 [ 3.455248] [] kernel_init_freeable+0xd2/0x14c [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] [] kernel_init+0x9/0xf0 [ 3.455248] [] ret_from_fork+0x7c/0xb0 [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- I haven't looked deeper into it yet, and will do so tomorrow, unless this spew is obvious to anyone. Thanks, Sasha From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755804Ab3AYEZk (ORCPT ); Thu, 24 Jan 2013 23:25:40 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:60096 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065Ab3AYEZh (ORCPT ); Thu, 24 Jan 2013 23:25:37 -0500 Date: Fri, 25 Jan 2013 12:25:12 +0800 From: Shaohua Li To: Sasha Levin Cc: Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130125042512.GA32017@kernel.org> References: <5101FFF5.6030503@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5101FFF5.6030503@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > Hi folks, > > Commit "swap: make each swap partition have one address_space" is triggering > a series of warnings on boot: > > [ 3.446071] ------------[ cut here ]------------ > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > [ 3.450360] Modules linked in: > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > [ 3.454508] Call Trace: > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > [ 3.455248] [] debug_print_object+0x8e/0xb0 > [ 3.455248] [] __debug_object_init+0x20b/0x290 > [ 3.455248] [] debug_object_init+0x15/0x20 > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > [ 3.455248] [] bdi_init+0x1ac/0x270 > [ 3.455248] [] swap_setup+0x3b/0x87 > [ 3.455248] [] ? swap_setup+0x87/0x87 > [ 3.455248] [] kswapd_init+0x11/0x7c > [ 3.455248] [] do_one_initcall+0x8a/0x180 > [ 3.455248] [] do_basic_setup+0x96/0xb4 > [ 3.455248] [] ? loglevel+0x31/0x31 > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] [] kernel_init+0x9/0xf0 > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > spew is obvious to anyone. Does this one help? Subject: give-each-swapper-space-separate-backing_dev_info The backing_dev_info can't be shared by all swapper address space. Reported-by: Sasha Levin Signed-off-by: Shaohua Li --- mm/swap.c | 1 + mm/swap_state.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) Index: linux/mm/swap.c =================================================================== --- linux.orig/mm/swap.c 2013-01-22 10:11:58.310933234 +0800 +++ linux/mm/swap.c 2013-01-25 12:14:49.524863610 +0800 @@ -859,6 +859,7 @@ void __init swap_setup(void) int i; for (i = 0; i < MAX_SWAPFILES; i++) { + swapper_spaces[i].backing_dev_info += i; bdi_init(swapper_spaces[i].backing_dev_info); spin_lock_init(&swapper_spaces[i].tree_lock); INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); Index: linux/mm/swap_state.c =================================================================== --- linux.orig/mm/swap_state.c 2013-01-24 18:08:05.149390977 +0800 +++ linux/mm/swap_state.c 2013-01-25 12:14:12.849323671 +0800 @@ -31,16 +31,19 @@ static const struct address_space_operat .migratepage = migrate_page, }; -static struct backing_dev_info swap_backing_dev_info = { - .name = "swap", - .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_SWAP_BACKED, +static struct backing_dev_info swap_backing_dev_info[MAX_SWAPFILES] = { + [0 ... MAX_SWAPFILES - 1] = { + .name = "swap", + .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | + BDI_CAP_SWAP_BACKED, + } }; struct address_space swapper_spaces[MAX_SWAPFILES] = { [0 ... MAX_SWAPFILES - 1] = { .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), .a_ops = &swap_aops, - .backing_dev_info = &swap_backing_dev_info, + .backing_dev_info = &swap_backing_dev_info[0], } }; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754647Ab3AYXhl (ORCPT ); Fri, 25 Jan 2013 18:37:41 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:48619 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753863Ab3AYXhj (ORCPT ); Fri, 25 Jan 2013 18:37:39 -0500 Message-ID: <51031738.4060102@oracle.com> Date: Fri, 25 Jan 2013 18:37:28 -0500 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130113 Thunderbird/17.0.2 MIME-Version: 1.0 To: Shaohua Li CC: Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , Hugh Dickins , linux-mm , "linux-kernel@vger.kernel.org" Subject: Re: boot warnings due to swap: make each swap partition have one address_space References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> In-Reply-To: <20130125042512.GA32017@kernel.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/24/2013 11:25 PM, Shaohua Li wrote: > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: >> Hi folks, >> >> Commit "swap: make each swap partition have one address_space" is triggering >> a series of warnings on boot: >> >> [ 3.446071] ------------[ cut here ]------------ >> [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() >> [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) >> [ 3.450360] Modules linked in: >> [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 >> [ 3.454508] Call Trace: >> [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 >> [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 >> [ 3.455248] [] debug_print_object+0x8e/0xb0 >> [ 3.455248] [] __debug_object_init+0x20b/0x290 >> [ 3.455248] [] debug_object_init+0x15/0x20 >> [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 >> [ 3.455248] [] bdi_init+0x1ac/0x270 >> [ 3.455248] [] swap_setup+0x3b/0x87 >> [ 3.455248] [] ? swap_setup+0x87/0x87 >> [ 3.455248] [] kswapd_init+0x11/0x7c >> [ 3.455248] [] do_one_initcall+0x8a/0x180 >> [ 3.455248] [] do_basic_setup+0x96/0xb4 >> [ 3.455248] [] ? loglevel+0x31/0x31 >> [ 3.455248] [] ? sched_init_smp+0x150/0x157 >> [ 3.455248] [] kernel_init_freeable+0xd2/0x14c >> [ 3.455248] [] ? rest_init+0x140/0x140 >> [ 3.455248] [] kernel_init+0x9/0xf0 >> [ 3.455248] [] ret_from_fork+0x7c/0xb0 >> [ 3.455248] [] ? rest_init+0x140/0x140 >> [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- >> >> I haven't looked deeper into it yet, and will do so tomorrow, unless this >> spew is obvious to anyone. > > Does this one help? [snip] Yup, it did. Thanks! Thanks, Sasha From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755384Ab3A0CQM (ORCPT ); Sat, 26 Jan 2013 21:16:12 -0500 Received: from mail-da0-f51.google.com ([209.85.210.51]:47219 "EHLO mail-da0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755098Ab3A0CQK (ORCPT ); Sat, 26 Jan 2013 21:16:10 -0500 Date: Sat, 26 Jan 2013 18:16:05 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Shaohua Li cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130125042512.GA32017@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Jan 2013, Shaohua Li wrote: > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > Hi folks, > > > > Commit "swap: make each swap partition have one address_space" is triggering > > a series of warnings on boot: > > > > [ 3.446071] ------------[ cut here ]------------ > > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > > [ 3.450360] Modules linked in: > > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > > [ 3.454508] Call Trace: > > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > > [ 3.455248] [] debug_print_object+0x8e/0xb0 > > [ 3.455248] [] __debug_object_init+0x20b/0x290 > > [ 3.455248] [] debug_object_init+0x15/0x20 > > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > > [ 3.455248] [] bdi_init+0x1ac/0x270 > > [ 3.455248] [] swap_setup+0x3b/0x87 > > [ 3.455248] [] ? swap_setup+0x87/0x87 > > [ 3.455248] [] kswapd_init+0x11/0x7c > > [ 3.455248] [] do_one_initcall+0x8a/0x180 > > [ 3.455248] [] do_basic_setup+0x96/0xb4 > > [ 3.455248] [] ? loglevel+0x31/0x31 > > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > > [ 3.455248] [] ? rest_init+0x140/0x140 > > [ 3.455248] [] kernel_init+0x9/0xf0 > > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > > [ 3.455248] [] ? rest_init+0x140/0x140 > > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > > spew is obvious to anyone. > > Does this one help? > > Subject: give-each-swapper-space-separate-backing_dev_info > > The backing_dev_info can't be shared by all swapper address space. Whyever not? It's perfectly normal for different inodes/address_spaces to share a single backing_dev! Sasha's trace says that it's wrong to initialize it MAX_SWAPFILES times: fair enough. But why should I now want to spend 32kB (not even counting their __percpu counters) on all these pseudo-backing_devs? Hugh p.s. a grand little change would be to move page_cluster and swap_setup() from mm/swap.c to mm/swap_state.c: they have nothing to do with the other contents of swap.c, and everything to do with the contents of swap_state.c. Why swap.c is called swap.c is rather a mystery. > > Reported-by: Sasha Levin > Signed-off-by: Shaohua Li > --- > mm/swap.c | 1 + > mm/swap_state.c | 11 +++++++---- > 2 files changed, 8 insertions(+), 4 deletions(-) > > Index: linux/mm/swap.c > =================================================================== > --- linux.orig/mm/swap.c 2013-01-22 10:11:58.310933234 +0800 > +++ linux/mm/swap.c 2013-01-25 12:14:49.524863610 +0800 > @@ -859,6 +859,7 @@ void __init swap_setup(void) > int i; > > for (i = 0; i < MAX_SWAPFILES; i++) { > + swapper_spaces[i].backing_dev_info += i; > bdi_init(swapper_spaces[i].backing_dev_info); > spin_lock_init(&swapper_spaces[i].tree_lock); > INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); > Index: linux/mm/swap_state.c > =================================================================== > --- linux.orig/mm/swap_state.c 2013-01-24 18:08:05.149390977 +0800 > +++ linux/mm/swap_state.c 2013-01-25 12:14:12.849323671 +0800 > @@ -31,16 +31,19 @@ static const struct address_space_operat > .migratepage = migrate_page, > }; > > -static struct backing_dev_info swap_backing_dev_info = { > - .name = "swap", > - .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_SWAP_BACKED, > +static struct backing_dev_info swap_backing_dev_info[MAX_SWAPFILES] = { > + [0 ... MAX_SWAPFILES - 1] = { > + .name = "swap", > + .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | > + BDI_CAP_SWAP_BACKED, > + } > }; > > struct address_space swapper_spaces[MAX_SWAPFILES] = { > [0 ... MAX_SWAPFILES - 1] = { > .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), > .a_ops = &swap_aops, > - .backing_dev_info = &swap_backing_dev_info, > + .backing_dev_info = &swap_backing_dev_info[0], > } > }; > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756027Ab3A0ONR (ORCPT ); Sun, 27 Jan 2013 09:13:17 -0500 Received: from mail-da0-f51.google.com ([209.85.210.51]:56624 "EHLO mail-da0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755807Ab3A0ONM (ORCPT ); Sun, 27 Jan 2013 09:13:12 -0500 Date: Sun, 27 Jan 2013 22:12:53 +0800 From: Shaohua Li To: Hugh Dickins Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130127141253.GA27019@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > On Fri, 25 Jan 2013, Shaohua Li wrote: > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > Hi folks, > > > > > > Commit "swap: make each swap partition have one address_space" is triggering > > > a series of warnings on boot: > > > > > > [ 3.446071] ------------[ cut here ]------------ > > > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > > > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > > > [ 3.450360] Modules linked in: > > > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > > > [ 3.454508] Call Trace: > > > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > > > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > > > [ 3.455248] [] debug_print_object+0x8e/0xb0 > > > [ 3.455248] [] __debug_object_init+0x20b/0x290 > > > [ 3.455248] [] debug_object_init+0x15/0x20 > > > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > > > [ 3.455248] [] bdi_init+0x1ac/0x270 > > > [ 3.455248] [] swap_setup+0x3b/0x87 > > > [ 3.455248] [] ? swap_setup+0x87/0x87 > > > [ 3.455248] [] kswapd_init+0x11/0x7c > > > [ 3.455248] [] do_one_initcall+0x8a/0x180 > > > [ 3.455248] [] do_basic_setup+0x96/0xb4 > > > [ 3.455248] [] ? loglevel+0x31/0x31 > > > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > > > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > > > [ 3.455248] [] ? rest_init+0x140/0x140 > > > [ 3.455248] [] kernel_init+0x9/0xf0 > > > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > > > [ 3.455248] [] ? rest_init+0x140/0x140 > > > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > > > > > I haven't looked deeper into it yet, and will do so tomorrow, unless this > > > spew is obvious to anyone. > > > > Does this one help? > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > The backing_dev_info can't be shared by all swapper address space. > > Whyever not? It's perfectly normal for different inodes/address_spaces > to share a single backing_dev! Sasha's trace says that it's wrong to > initialize it MAX_SWAPFILES times: fair enough. But why should I now > want to spend 32kB (not even counting their __percpu counters) on all > these pseudo-backing_devs? That's correct, silly me. Updated it. > > p.s. a grand little change would be to move page_cluster and swap_setup() > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > contents of swap.c, and everything to do with the contents of swap_state.c. > Why swap.c is called swap.c is rather a mystery. Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will make it optional. don't want to add another #ifdef, so give up. Subject: init-swap-space-backing-dev-info-once Sasha reported: Commit "swap: make each swap partition have one address_space" is triggering a series of warnings on boot: [ 3.446071] ------------[ cut here ]------------ [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) [ 3.450360] Modules linked in: [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 [ 3.454508] Call Trace: [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 [ 3.455248] [] debug_print_object+0x8e/0xb0 [ 3.455248] [] __debug_object_init+0x20b/0x290 [ 3.455248] [] debug_object_init+0x15/0x20 [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 [ 3.455248] [] bdi_init+0x1ac/0x270 [ 3.455248] [] swap_setup+0x3b/0x87 [ 3.455248] [] ? swap_setup+0x87/0x87 [ 3.455248] [] kswapd_init+0x11/0x7c [ 3.455248] [] do_one_initcall+0x8a/0x180 [ 3.455248] [] do_basic_setup+0x96/0xb4 [ 3.455248] [] ? loglevel+0x31/0x31 [ 3.455248] [] ? sched_init_smp+0x150/0x157 [ 3.455248] [] kernel_init_freeable+0xd2/0x14c [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] [] kernel_init+0x9/0xf0 [ 3.455248] [] ret_from_fork+0x7c/0xb0 [ 3.455248] [] ? rest_init+0x140/0x140 [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- Initialize swap space backing_dev_info once to avoid the warning. Reported-by: Sasha Levin Signed-off-by: Shaohua Li --- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/mm/swap.c =================================================================== --- linux.orig/mm/swap.c 2013-01-27 21:26:21.942696713 +0800 +++ linux/mm/swap.c 2013-01-27 21:27:29.233865394 +0800 @@ -858,8 +858,8 @@ void __init swap_setup(void) #ifdef CONFIG_SWAP int i; + bdi_init(swapper_spaces[0].backing_dev_info); for (i = 0; i < MAX_SWAPFILES; i++) { - bdi_init(swapper_spaces[i].backing_dev_info); spin_lock_init(&swapper_spaces[i].tree_lock); INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756605Ab3A0Vkm (ORCPT ); Sun, 27 Jan 2013 16:40:42 -0500 Received: from mail-da0-f53.google.com ([209.85.210.53]:57495 "EHLO mail-da0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756561Ab3A0Vkk (ORCPT ); Sun, 27 Jan 2013 16:40:40 -0500 Date: Sun, 27 Jan 2013 13:40:40 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Shaohua Li cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130127141253.GA27019@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 27 Jan 2013, Shaohua Li wrote: > On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > > On Fri, 25 Jan 2013, Shaohua Li wrote: > > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > > > The backing_dev_info can't be shared by all swapper address space. > > > > Whyever not? It's perfectly normal for different inodes/address_spaces > > to share a single backing_dev! Sasha's trace says that it's wrong to > > initialize it MAX_SWAPFILES times: fair enough. But why should I now > > want to spend 32kB (not even counting their __percpu counters) on all > > these pseudo-backing_devs? > > That's correct, silly me. Updated it. Looks much more to my taste, thank you! > > > > p.s. a grand little change would be to move page_cluster and swap_setup() > > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > > contents of swap.c, and everything to do with the contents of swap_state.c. > > Why swap.c is called swap.c is rather a mystery. > > Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will > make it optional. don't want to add another #ifdef, so give up. Good point, thanks for trying, maybe I'll attack it next time it irritates me. I don't yet know whether I approve of your changes or not, but running with them to see (and I'll send another bugfix separately in a moment). I was the one who removed the swap_device_lock() which 2.4 used, because it almost always ended up having to take both swap_list_lock() and swap_device_lock(si). You seem to have done a much better job of separating them usefully, but I need to convince myself that it does end up safely. My reservations so far would be: how many installations actually have more than one swap area, so is it a good tradeoff to add more overhead to help those at the (slight) expense of everyone else? The increasingly ugly page_mapping() worries me, and the static array of swapper_spaces annoys me a little. I'm glad Minchan has now pointed you to Rik's posting of two years ago: I think there are more important changes to be made in that direction. Hugh > > > Subject: init-swap-space-backing-dev-info-once > > > Sasha reported: > Commit "swap: make each swap partition have one address_space" is triggering > a series of warnings on boot: > > [ 3.446071] ------------[ cut here ]------------ > [ 3.446664] WARNING: at lib/debugobjects.c:261 debug_print_object+0x8e/0xb0() > [ 3.447715] ODEBUG: init active (active state 0) object type: percpu_counter hint: (null) > [ 3.450360] Modules linked in: > [ 3.451593] Pid: 1, comm: swapper/0 Tainted: G W 3.8.0-rc4-next-20130124-sasha-00004-g838a1b4 #266 > [ 3.454508] Call Trace: > [ 3.455248] [] warn_slowpath_common+0x8c/0xc0 > [ 3.455248] [] warn_slowpath_fmt+0x41/0x50 > [ 3.455248] [] debug_print_object+0x8e/0xb0 > [ 3.455248] [] __debug_object_init+0x20b/0x290 > [ 3.455248] [] debug_object_init+0x15/0x20 > [ 3.455248] [] __percpu_counter_init+0x6d/0xe0 > [ 3.455248] [] bdi_init+0x1ac/0x270 > [ 3.455248] [] swap_setup+0x3b/0x87 > [ 3.455248] [] ? swap_setup+0x87/0x87 > [ 3.455248] [] kswapd_init+0x11/0x7c > [ 3.455248] [] do_one_initcall+0x8a/0x180 > [ 3.455248] [] do_basic_setup+0x96/0xb4 > [ 3.455248] [] ? loglevel+0x31/0x31 > [ 3.455248] [] ? sched_init_smp+0x150/0x157 > [ 3.455248] [] kernel_init_freeable+0xd2/0x14c > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] [] kernel_init+0x9/0xf0 > [ 3.455248] [] ret_from_fork+0x7c/0xb0 > [ 3.455248] [] ? rest_init+0x140/0x140 > [ 3.455248] ---[ end trace 0b176d5c0f21bffb ]--- > > Initialize swap space backing_dev_info once to avoid the warning. > > Reported-by: Sasha Levin > Signed-off-by: Shaohua Li > --- > mm/swap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux/mm/swap.c > =================================================================== > --- linux.orig/mm/swap.c 2013-01-27 21:26:21.942696713 +0800 > +++ linux/mm/swap.c 2013-01-27 21:27:29.233865394 +0800 > @@ -858,8 +858,8 @@ void __init swap_setup(void) > #ifdef CONFIG_SWAP > int i; > > + bdi_init(swapper_spaces[0].backing_dev_info); > for (i = 0; i < MAX_SWAPFILES; i++) { > - bdi_init(swapper_spaces[i].backing_dev_info); > spin_lock_init(&swapper_spaces[i].tree_lock); > INIT_LIST_HEAD(&swapper_spaces[i].i_mmap_nonlinear); > } > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756616Ab3A0VrC (ORCPT ); Sun, 27 Jan 2013 16:47:02 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:43310 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756545Ab3A0VrA (ORCPT ); Sun, 27 Jan 2013 16:47:00 -0500 Date: Sun, 27 Jan 2013 13:47:01 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Shaohua Li cc: Andrew Morton , Sasha Levin , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix In-Reply-To: <20130127141253.GA27019@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I had all cpus spinning in swap_info_get(), for the lock on an area being swapped off: probably because get_swap_page() forgot to unlock. Signed-off-by: Hugh Dickins --- mm/swapfile.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- mmotm.orig/mm/swapfile.c 2013-01-23 17:55:39.132447115 -0800 +++ mmotm/mm/swapfile.c 2013-01-27 10:41:45.000000000 -0800 @@ -470,10 +470,9 @@ swp_entry_t get_swap_page(void) spin_unlock(&swap_lock); /* This is called for allocating swap entry for cache */ offset = scan_swap_map(si, SWAP_HAS_CACHE); - if (offset) { - spin_unlock(&si->lock); + spin_unlock(&si->lock); + if (offset) return swp_entry(type, offset); - } spin_lock(&swap_lock); next = swap_list.next; } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757020Ab3A1AHf (ORCPT ); Sun, 27 Jan 2013 19:07:35 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:46211 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756978Ab3A1AHY (ORCPT ); Sun, 27 Jan 2013 19:07:24 -0500 Date: Mon, 28 Jan 2013 08:07:05 +0800 From: Shaohua Li To: Hugh Dickins Cc: Andrew Morton , Sasha Levin , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix Message-ID: <20130128000705.GA1306@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 27, 2013 at 01:47:01PM -0800, Hugh Dickins wrote: > I had all cpus spinning in swap_info_get(), for the lock on an area > being swapped off: probably because get_swap_page() forgot to unlock. > > Signed-off-by: Hugh Dickins Good catch. Thanks! > --- > > mm/swapfile.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > --- mmotm.orig/mm/swapfile.c 2013-01-23 17:55:39.132447115 -0800 > +++ mmotm/mm/swapfile.c 2013-01-27 10:41:45.000000000 -0800 > @@ -470,10 +470,9 @@ swp_entry_t get_swap_page(void) > spin_unlock(&swap_lock); > /* This is called for allocating swap entry for cache */ > offset = scan_swap_map(si, SWAP_HAS_CACHE); > - if (offset) { > - spin_unlock(&si->lock); > + spin_unlock(&si->lock); > + if (offset) > return swp_entry(type, offset); > - } > spin_lock(&swap_lock); > next = swap_list.next; > } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754612Ab3A3KA7 (ORCPT ); Wed, 30 Jan 2013 05:00:59 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:56067 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754478Ab3A3KAv (ORCPT ); Wed, 30 Jan 2013 05:00:51 -0500 Date: Wed, 30 Jan 2013 17:59:44 +0800 From: Shaohua Li To: Hugh Dickins Cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: boot warnings due to swap: make each swap partition have one address_space Message-ID: <20130130095944.GA11457@kernel.org> References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 27, 2013 at 01:40:40PM -0800, Hugh Dickins wrote: > On Sun, 27 Jan 2013, Shaohua Li wrote: > > On Sat, Jan 26, 2013 at 06:16:05PM -0800, Hugh Dickins wrote: > > > On Fri, 25 Jan 2013, Shaohua Li wrote: > > > > On Thu, Jan 24, 2013 at 10:45:57PM -0500, Sasha Levin wrote: > > > > > > > > Subject: give-each-swapper-space-separate-backing_dev_info > > > > > > > > The backing_dev_info can't be shared by all swapper address space. > > > > > > Whyever not? It's perfectly normal for different inodes/address_spaces > > > to share a single backing_dev! Sasha's trace says that it's wrong to > > > initialize it MAX_SWAPFILES times: fair enough. But why should I now > > > want to spend 32kB (not even counting their __percpu counters) on all > > > these pseudo-backing_devs? > > > > That's correct, silly me. Updated it. > > Looks much more to my taste, thank you! > > > > > > > p.s. a grand little change would be to move page_cluster and swap_setup() > > > from mm/swap.c to mm/swap_state.c: they have nothing to do with the other > > > contents of swap.c, and everything to do with the contents of swap_state.c. > > > Why swap.c is called swap.c is rather a mystery. > > > > Tried, but looks page_cluster is used in sysctl, moving to swap_state.c will > > make it optional. don't want to add another #ifdef, so give up. > > Good point, thanks for trying, maybe I'll attack it next time it > irritates me. > > I don't yet know whether I approve of your changes or not, but running > with them to see (and I'll send another bugfix separately in a moment). > > I was the one who removed the swap_device_lock() which 2.4 used, > because it almost always ended up having to take both swap_list_lock() > and swap_device_lock(si). You seem to have done a much better job of > separating them usefully, but I need to convince myself that it does > end up safely. > > My reservations so far would be: how many installations actually have > more than one swap area, so is it a good tradeoff to add more overhead > to help those at the (slight) expense of everyone else? The increasingly > ugly page_mapping() worries me, and the static array of swapper_spaces > annoys me a little. > > I'm glad Minchan has now pointed you to Rik's posting of two years ago: > I think there are more important changes to be made in that direction. Not sure how others use multiple swaps, but current lock contention forces us to use multiple swaps. I haven't carefully think about Rik's posting, but looks it doesn't solve the lock contention problem. Thanks, Shaohua From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446Ab3BDFMB (ORCPT ); Mon, 4 Feb 2013 00:12:01 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:58744 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790Ab3BDFMA (ORCPT ); Mon, 4 Feb 2013 00:12:00 -0500 Date: Sun, 3 Feb 2013 21:12:05 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Shaohua Li cc: Sasha Levin , Andrew Morton , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: boot warnings due to swap: make each swap partition have one address_space In-Reply-To: <20130130095944.GA11457@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> <20130130095944.GA11457@kernel.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 30 Jan 2013, Shaohua Li wrote: > On Sun, Jan 27, 2013 at 01:40:40PM -0800, Hugh Dickins wrote: > > > > I'm glad Minchan has now pointed you to Rik's posting of two years ago: > > I think there are more important changes to be made in that direction. > > Not sure how others use multiple swaps, but current lock contention forces us > to use multiple swaps. I haven't carefully think about Rik's posting, but looks > it doesn't solve the lock contention problem. Nobody had reported any swap lock contention problem before your patch, so no, Rik's posting wasn't directed at that. I always thought swap writing patterns a much bigger problem. But if lock contention there is, then I think it can be implemented with reducing that in mind. There are two levels of allocation: one to allocate the tokens which we will insert in page tables, and one to allocate the final diskspace to which those tokens will point. (I may be using totally different language from Rik, it's the principles that I have in mind, not his actual posting.) Allocating the tokens can very well be done with per-cpu batches, perhaps of SWAP_CLUSTER_MAX 32 to match vmscan.c's batching: there is no significance to their ordering. And allocating the diskspace would want to be done in batches, to maximize contiguous writing. That may not solve all the swap_info_get() contention which you saw, but should help some. I'm thinking that we go with your per-swapper-space locking for now; but I wouldn't mind taking it out again later, if we arrive at a better solution which benefits even those with a single swap area. Hugh