From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Senozhatsky Subject: Re: kswapd using __this_cpu_add() in preemptible code Date: Wed, 19 Mar 2014 09:20:00 +0300 Message-ID: <20140319062000.GA435@swordfish> References: <20140318185329.GB430@swordfish> <20140318142216.317bf986d10a564881791100@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexander Viro , Mel Gorman , Michal Hocko , Rik van Riel , Johannes Weiner , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter To: Andrew Morton Return-path: Content-Disposition: inline In-Reply-To: <20140318142216.317bf986d10a564881791100@linux-foundation.org> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On (03/18/14 14:22), Andrew Morton wrote: > On Tue, 18 Mar 2014 21:53:30 +0300 Sergey Senozhatsky wrote: > > > Hello gentlemen, > > > > Commit 589a606f9539663f162e4a110d117527833b58a4 ("percpu: add preemption > > checks to __this_cpu ops") added preempt check to used in __count_vm_events() > > __this_cpu ops, causing the following kswapd warning: > > > > BUG: using __this_cpu_add() in preemptible [00000000] code: kswapd0/56 > > caller is __this_cpu_preempt_check+0x2b/0x2d > > Call Trace: > > [] dump_stack+0x4e/0x7a > > [] check_preemption_disabled+0xce/0xdd > > [] __this_cpu_preempt_check+0x2b/0x2d > > [] inode_lru_isolate+0xed/0x197 > > [] list_lru_walk_node+0x7b/0x14c > > [] ? iput+0x131/0x131 > > [] prune_icache_sb+0x35/0x4c > > [] super_cache_scan+0xe3/0x143 > > [] shrink_slab_node+0x103/0x16f > > [] shrink_slab+0x75/0xe4 > > [] balance_pgdat+0x2fa/0x47f > > [] kswapd+0x2d3/0x2fd > > [] ? __wake_up_sync+0xd/0xd > > [] ? balance_pgdat+0x47f/0x47f > > [] kthread+0xd6/0xde > > [] ? kthread_create_on_node+0x162/0x162 > > [] ret_from_fork+0x7c/0xb0 > > [] ? kthread_create_on_node+0x162/0x162 > > > > > > list_lru_walk_node() seems to be the only place where __count_vm_events() > > called with preemption enabled. remaining __count_vm_events() and > > __count_vm_event() calls are done with preemption disabled (unless I > > overlooked something). > > Christoph caught one. How does this look? > Thank you. Tested-by: Sergey Senozhatsky -ss > > > From: Andrew Morton > Subject: fs/inode.c:inode_lru_isolate(): use atomic count_vm_events() > > "percpu: add preemption checks to __this_cpu ops" added preempt check to > used in __count_vm_events() __this_cpu ops, causing the following kswapd > warning: > > BUG: using __this_cpu_add() in preemptible [00000000] code: kswapd0/56 > caller is __this_cpu_preempt_check+0x2b/0x2d > Call Trace: > [] dump_stack+0x4e/0x7a > [] check_preemption_disabled+0xce/0xdd > [] __this_cpu_preempt_check+0x2b/0x2d > [] inode_lru_isolate+0xed/0x197 > [] list_lru_walk_node+0x7b/0x14c > [] ? iput+0x131/0x131 > [] prune_icache_sb+0x35/0x4c > > Switch from __count_vm_events() to the preempt-safe count_vm_events(). > > Reported-by: Sergey Senozhatsky > Cc: Christoph Lameter > Signed-off-by: Andrew Morton > --- > > fs/inode.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff -puN fs/inode.c~fs-inodec-inode_lru_isolate-use-atomic-count_vm_events fs/inode.c > --- a/fs/inode.c~fs-inodec-inode_lru_isolate-use-atomic-count_vm_events > +++ a/fs/inode.c > @@ -722,9 +722,9 @@ inode_lru_isolate(struct list_head *item > unsigned long reap; > reap = invalidate_mapping_pages(&inode->i_data, 0, -1); > if (current_is_kswapd()) > - __count_vm_events(KSWAPD_INODESTEAL, reap); > + count_vm_events(KSWAPD_INODESTEAL, reap); > else > - __count_vm_events(PGINODESTEAL, reap); > + count_vm_events(PGINODESTEAL, reap); > if (current->reclaim_state) > current->reclaim_state->reclaimed_slab += reap; > } > _ > -- 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