From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754600AbbGTOCl (ORCPT ); Mon, 20 Jul 2015 10:02:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:42283 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932105AbbGTOCk (ORCPT ); Mon, 20 Jul 2015 10:02:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,508,1432623600"; d="scan'208";a="767669901" Date: Mon, 20 Jul 2015 22:01:11 +0800 From: Fengguang Wu To: Mel Gorman Cc: Andrew Morton , peterz@infradead.org, nicstange@gmail.com, Linux Memory Management List , linux-kernel@vger.kernel.org, LKP Subject: Re: [mminit] [ INFO: possible recursive locking detected ] Message-ID: <20150720140111.GA4715@wfg-t540p.sh.intel.com> References: <20150714000910.GA8160@wfg-t540p.sh.intel.com> <20150714103108.GA6812@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150714103108.GA6812@suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mel, On Tue, Jul 14, 2015 at 11:31:08AM +0100, Mel Gorman wrote: > On Tue, Jul 14, 2015 at 08:09:10AM +0800, Fengguang Wu wrote: > > Greetings, > > > > 0day kernel testing robot got the below dmesg and the first bad commit is > > > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > > > Can you check if this patch addresses the problem please? It works! Tested-by: Fengguang Wu Thanks, Fengguang > ---8<--- > mm, meminit: replace rwsem with completion > > From: Nicolai Stange > > Commit 0e1cc95b4cc7 ("mm: meminit: finish initialisation of struct pages > before basic setup") introduced a rwsem to signal completion of the > initialization workers. > > Lockdep complains about possible recursive locking: > ============================================= > [ INFO: possible recursive locking detected ] > 4.1.0-12802-g1dc51b8 #3 Not tainted > --------------------------------------------- > swapper/0/1 is trying to acquire lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0xc7/0xe6 > > but task is already holding lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0x3e/0xe6 > > Replace the rwsem by a completion together with an atomic > "outstanding work counter". > > [peterz@infradead.org: Barrier removal on the grounds of being pointless] > [mgorman@suse.de: Applied review feedback] > Signed-off-by: Nicolai Stange > Signed-off-by: Mel Gorman > --- > mm/page_alloc.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 506eac8b38af..a69e78c396a0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1062,7 +1061,15 @@ static void __init deferred_free_range(struct page *page, > __free_pages_boot_core(page, pfn, 0); > } > > -static __initdata DECLARE_RWSEM(pgdat_init_rwsem); > +/* Completion tracking for deferred_init_memmap() threads */ > +static atomic_t pgdat_init_n_undone __initdata; > +static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); > + > +static inline void __init pgdat_init_report_one_done(void) > +{ > + if (atomic_dec_and_test(&pgdat_init_n_undone)) > + complete(&pgdat_init_all_done_comp); > +} > > /* Initialise remaining memory on a node */ > static int __init deferred_init_memmap(void *data) > @@ -1079,7 +1086,7 @@ static int __init deferred_init_memmap(void *data) > const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); > > if (first_init_pfn == ULONG_MAX) { > - up_read(&pgdat_init_rwsem); > + pgdat_init_report_one_done(); > return 0; > } > > @@ -1179,7 +1186,8 @@ free_range: > > pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, > jiffies_to_msecs(jiffies - start)); > - up_read(&pgdat_init_rwsem); > + > + pgdat_init_report_one_done(); > return 0; > } > > @@ -1187,14 +1195,14 @@ void __init page_alloc_init_late(void) > { > int nid; > > + /* There will be num_node_state(N_MEMORY) threads */ > + atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); > for_each_node_state(nid, N_MEMORY) { > - down_read(&pgdat_init_rwsem); > kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); > } > > /* Block until all are initialised */ > - down_write(&pgdat_init_rwsem); > - up_write(&pgdat_init_rwsem); > + wait_for_completion(&pgdat_init_all_done_comp); > } > #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f177.google.com (mail-ig0-f177.google.com [209.85.213.177]) by kanga.kvack.org (Postfix) with ESMTP id 1A1439003C7 for ; Mon, 20 Jul 2015 10:03:03 -0400 (EDT) Received: by igvi1 with SMTP id i1so77320600igv.1 for ; Mon, 20 Jul 2015 07:03:03 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com. [134.134.136.65]) by mx.google.com with ESMTP id h10si6079084iga.77.2015.07.20.07.03.01 for ; Mon, 20 Jul 2015 07:03:02 -0700 (PDT) Date: Mon, 20 Jul 2015 22:01:11 +0800 From: Fengguang Wu Subject: Re: [mminit] [ INFO: possible recursive locking detected ] Message-ID: <20150720140111.GA4715@wfg-t540p.sh.intel.com> References: <20150714000910.GA8160@wfg-t540p.sh.intel.com> <20150714103108.GA6812@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150714103108.GA6812@suse.de> Sender: owner-linux-mm@kvack.org List-ID: To: Mel Gorman Cc: Andrew Morton , peterz@infradead.org, nicstange@gmail.com, Linux Memory Management List , linux-kernel@vger.kernel.org, LKP Hi Mel, On Tue, Jul 14, 2015 at 11:31:08AM +0100, Mel Gorman wrote: > On Tue, Jul 14, 2015 at 08:09:10AM +0800, Fengguang Wu wrote: > > Greetings, > > > > 0day kernel testing robot got the below dmesg and the first bad commit is > > > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > > > Can you check if this patch addresses the problem please? It works! Tested-by: Fengguang Wu Thanks, Fengguang > ---8<--- > mm, meminit: replace rwsem with completion > > From: Nicolai Stange > > Commit 0e1cc95b4cc7 ("mm: meminit: finish initialisation of struct pages > before basic setup") introduced a rwsem to signal completion of the > initialization workers. > > Lockdep complains about possible recursive locking: > ============================================= > [ INFO: possible recursive locking detected ] > 4.1.0-12802-g1dc51b8 #3 Not tainted > --------------------------------------------- > swapper/0/1 is trying to acquire lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0xc7/0xe6 > > but task is already holding lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0x3e/0xe6 > > Replace the rwsem by a completion together with an atomic > "outstanding work counter". > > [peterz@infradead.org: Barrier removal on the grounds of being pointless] > [mgorman@suse.de: Applied review feedback] > Signed-off-by: Nicolai Stange > Signed-off-by: Mel Gorman > --- > mm/page_alloc.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 506eac8b38af..a69e78c396a0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1062,7 +1061,15 @@ static void __init deferred_free_range(struct page *page, > __free_pages_boot_core(page, pfn, 0); > } > > -static __initdata DECLARE_RWSEM(pgdat_init_rwsem); > +/* Completion tracking for deferred_init_memmap() threads */ > +static atomic_t pgdat_init_n_undone __initdata; > +static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); > + > +static inline void __init pgdat_init_report_one_done(void) > +{ > + if (atomic_dec_and_test(&pgdat_init_n_undone)) > + complete(&pgdat_init_all_done_comp); > +} > > /* Initialise remaining memory on a node */ > static int __init deferred_init_memmap(void *data) > @@ -1079,7 +1086,7 @@ static int __init deferred_init_memmap(void *data) > const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); > > if (first_init_pfn == ULONG_MAX) { > - up_read(&pgdat_init_rwsem); > + pgdat_init_report_one_done(); > return 0; > } > > @@ -1179,7 +1186,8 @@ free_range: > > pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, > jiffies_to_msecs(jiffies - start)); > - up_read(&pgdat_init_rwsem); > + > + pgdat_init_report_one_done(); > return 0; > } > > @@ -1187,14 +1195,14 @@ void __init page_alloc_init_late(void) > { > int nid; > > + /* There will be num_node_state(N_MEMORY) threads */ > + atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); > for_each_node_state(nid, N_MEMORY) { > - down_read(&pgdat_init_rwsem); > kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); > } > > /* Block until all are initialised */ > - down_write(&pgdat_init_rwsem); > - up_write(&pgdat_init_rwsem); > + wait_for_completion(&pgdat_init_all_done_comp); > } > #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ > -- 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 Content-Type: multipart/mixed; boundary="===============7795282425387427791==" MIME-Version: 1.0 From: Fengguang Wu To: lkp@lists.01.org Subject: Re: [mminit] [ INFO: possible recursive locking detected ] Date: Mon, 20 Jul 2015 22:01:11 +0800 Message-ID: <20150720140111.GA4715@wfg-t540p.sh.intel.com> In-Reply-To: <20150714103108.GA6812@suse.de> List-Id: --===============7795282425387427791== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Mel, On Tue, Jul 14, 2015 at 11:31:08AM +0100, Mel Gorman wrote: > On Tue, Jul 14, 2015 at 08:09:10AM +0800, Fengguang Wu wrote: > > Greetings, > > = > > 0day kernel testing robot got the below dmesg and the first bad commit = is > > = > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > = > = > Can you check if this patch addresses the problem please? It works! Tested-by: Fengguang Wu Thanks, Fengguang > ---8<--- > mm, meminit: replace rwsem with completion > = > From: Nicolai Stange > = > Commit 0e1cc95b4cc7 ("mm: meminit: finish initialisation of struct pages > before basic setup") introduced a rwsem to signal completion of the > initialization workers. > = > Lockdep complains about possible recursive locking: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > [ INFO: possible recursive locking detected ] > 4.1.0-12802-g1dc51b8 #3 Not tainted > --------------------------------------------- > swapper/0/1 is trying to acquire lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0xc7/0xe6 > = > but task is already holding lock: > (pgdat_init_rwsem){++++.+}, > at: [] page_alloc_init_late+0x3e/0xe6 > = > Replace the rwsem by a completion together with an atomic > "outstanding work counter". > = > [peterz(a)infradead.org: Barrier removal on the grounds of being pointles= s] > [mgorman(a)suse.de: Applied review feedback] > Signed-off-by: Nicolai Stange > Signed-off-by: Mel Gorman > --- > mm/page_alloc.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > = > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 506eac8b38af..a69e78c396a0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1062,7 +1061,15 @@ static void __init deferred_free_range(struct page= *page, > __free_pages_boot_core(page, pfn, 0); > } > = > -static __initdata DECLARE_RWSEM(pgdat_init_rwsem); > +/* Completion tracking for deferred_init_memmap() threads */ > +static atomic_t pgdat_init_n_undone __initdata; > +static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); > + > +static inline void __init pgdat_init_report_one_done(void) > +{ > + if (atomic_dec_and_test(&pgdat_init_n_undone)) > + complete(&pgdat_init_all_done_comp); > +} > = > /* Initialise remaining memory on a node */ > static int __init deferred_init_memmap(void *data) > @@ -1079,7 +1086,7 @@ static int __init deferred_init_memmap(void *data) > const struct cpumask *cpumask =3D cpumask_of_node(pgdat->node_id); > = > if (first_init_pfn =3D=3D ULONG_MAX) { > - up_read(&pgdat_init_rwsem); > + pgdat_init_report_one_done(); > return 0; > } > = > @@ -1179,7 +1186,8 @@ free_range: > = > pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, > jiffies_to_msecs(jiffies - start)); > - up_read(&pgdat_init_rwsem); > + > + pgdat_init_report_one_done(); > return 0; > } > = > @@ -1187,14 +1195,14 @@ void __init page_alloc_init_late(void) > { > int nid; > = > + /* There will be num_node_state(N_MEMORY) threads */ > + atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); > for_each_node_state(nid, N_MEMORY) { > - down_read(&pgdat_init_rwsem); > kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); > } > = > /* Block until all are initialised */ > - down_write(&pgdat_init_rwsem); > - up_write(&pgdat_init_rwsem); > + wait_for_completion(&pgdat_init_all_done_comp); > } > #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ > =20 --===============7795282425387427791==--