From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx177.postini.com [74.125.245.177]) by kanga.kvack.org (Postfix) with SMTP id DB3976B005C for ; Tue, 29 May 2012 08:34:18 -0400 (EDT) Date: Tue, 29 May 2012 14:34:08 +0200 From: Jan Kara Subject: Re: [PATCH 2/2] block: Convert BDI proportion calculations to flexible proportions Message-ID: <20120529123408.GA23991@quack.suse.cz> References: <1337878751-22942-1-git-send-email-jack@suse.cz> <1337878751-22942-3-git-send-email-jack@suse.cz> <1338220185.4284.19.camel@lappy> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1338220185.4284.19.camel@lappy> Sender: owner-linux-mm@kvack.org List-ID: To: Sasha Levin Cc: Jan Kara , Wu Fengguang , Peter Zijlstra , linux-mm@kvack.org, LKML On Mon 28-05-12 17:49:45, Sasha Levin wrote: > Hi Jan, > > On Thu, 2012-05-24 at 18:59 +0200, Jan Kara wrote: > > Convert calculations of proportion of writeback each bdi does to new flexible > > proportion code. That allows us to use aging period of fixed wallclock time > > which gives better proportion estimates given the hugely varying throughput of > > different devices. > > > > Signed-off-by: Jan Kara > > --- > > This patch appears to be causing lockdep warnings over here: Actually, this is not caused directly by my patch. Just my patch makes the problem more likely because I use smaller counter batch in __fprop_inc_percpu_max() than is used in original __prop_inc_percpu_max(), so the probability that percpu counter takes spinlock (which is what triggers the warning) is higher. The only safe solution seems to be to create a variant of percpu counters that can be used from an interrupt. Or do you have other idea Peter? Honza > > [ 20.545016] ================================= > [ 20.545016] [ INFO: inconsistent lock state ] > [ 20.545016] 3.4.0-next-20120528-sasha-00008-g11ef39f #307 Tainted: G W > [ 20.545016] --------------------------------- > [ 20.545016] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. > [ 20.545016] rcu_torture_rea/2493 [HC0[0]:SC1[1]:HE1:SE0] takes: > [ 20.545016] (key#3){?.-...}, at: [] __percpu_counter_sum+0x17/0xc0 > [ 20.545016] {IN-HARDIRQ-W} state was registered at: > [ 20.545016] [] mark_irqflags+0x6b/0x170 > [ 20.545016] [] __lock_acquire+0x2bb/0x4c0 > [ 20.545016] [] lock_acquire+0x18a/0x1e0 > [ 20.545016] [] _raw_spin_lock+0x3b/0x70 > [ 20.545016] [] __percpu_counter_add+0x50/0xb0 > [ 20.545016] [] __fprop_inc_percpu_max+0x8a/0xa0 > [ 20.545016] [] test_clear_page_writeback+0x12d/0x1c0 > [ 20.545016] [] end_page_writeback+0x24/0x50 > [ 20.545016] [] end_buffer_async_write+0x26a/0x350 > [ 20.545016] [] end_bio_bh_io_sync+0x3d/0x50 > [ 20.545016] [] bio_endio+0x29/0x30 > [ 20.545016] [] req_bio_endio+0xb9/0xd0 > [ 20.545016] [] blk_update_request+0x1a8/0x3c0 > [ 20.545016] [] blk_update_bidi_request+0x22/0x90 > [ 20.545016] [] __blk_end_bidi_request+0x1c/0x40 > [ 20.545016] [] __blk_end_request_all+0x28/0x40 > [ 20.545016] [] blk_done+0x9e/0xf0 > [ 20.545016] [] vring_interrupt+0x86/0xa0 > [ 20.680186] [] handle_irq_event_percpu+0x151/0x3e0 > [ 20.680186] [] handle_irq_event+0x43/0x70 > [ 20.680186] [] handle_edge_irq+0xe8/0x120 > [ 20.680186] [] handle_irq+0x164/0x180 > [ 20.680186] [] do_IRQ+0x58/0xd0 > [ 20.680186] [] ret_from_intr+0x0/0x1a > [ 20.680186] [] blk_queue_bio+0x30d/0x430 > [ 20.680186] [] generic_make_request+0xbe/0x120 > [ 20.680186] [] submit_bio+0xf8/0x120 > [ 20.680186] [] submit_bh+0x122/0x150 > [ 20.680186] [] __block_write_full_page+0x287/0x3b0 > [ 20.680186] [] block_write_full_page_endio+0xfc/0x120 > [ 20.680186] [] block_write_full_page+0x10/0x20 > [ 20.680186] [] blkdev_writepage+0x13/0x20 > [ 20.680186] [] __writepage+0x15/0x40 > [ 20.680186] [] write_cache_pages+0x49f/0x650 > [ 20.680186] [] generic_writepages+0x4f/0x70 > [ 20.680186] [] do_writepages+0x1e/0x50 > [ 20.680186] [] __filemap_fdatawrite_range+0x49/0x50 > [ 20.680186] [] filemap_fdatawrite+0x1a/0x20 > [ 20.680186] [] filemap_write_and_wait+0x25/0x50 > [ 20.680186] [] __sync_blockdev+0x2d/0x40 > [ 20.680186] [] sync_blockdev+0xe/0x10 > [ 20.680186] [] journal_recover+0x182/0x1c0 > [ 20.680186] [] journal_load+0x58/0xa0 > [ 20.680186] [] ext3_load_journal+0x200/0x2b0 > [ 20.680186] [] ext3_fill_super+0xc18/0x10d0 > [ 20.680186] [] mount_bdev+0x176/0x210 > [ 20.680186] [] ext3_mount+0x10/0x20 > [ 20.680186] [] mount_fs+0x85/0x1a0 > [ 20.680186] [] vfs_kern_mount+0x74/0x100 > [ 20.680186] [] do_kern_mount+0x51/0x120 > [ 20.680186] [] do_mount+0x1d4/0x240 > [ 20.680186] [] sys_mount+0x9d/0xe0 > [ 20.680186] [] do_mount_root+0x1e/0x94 > [ 20.680186] [] mount_block_root+0xe2/0x224 > [ 20.680186] [] mount_root+0x12b/0x136 > [ 20.680186] [] prepare_namespace+0x165/0x19e > [ 20.680186] [] kernel_init+0x274/0x28a > [ 20.680186] [] kernel_thread_helper+0x4/0x10 > [ 20.680186] irq event stamp: 1551906 > [ 20.680186] hardirqs last enabled at (1551906): [] _raw_spin_unlock_irq+0x2b/0x80 > [ 20.680186] hardirqs last disabled at (1551905): [] _raw_spin_lock_irq+0x34/0xa0 > [ 20.680186] softirqs last enabled at (1551022): [] __do_softirq+0x3db/0x460 > [ 20.680186] softirqs last disabled at (1551903): [] call_softirq+0x1c/0x30 > [ 20.680186] > [ 20.680186] other info that might help us debug this: > [ 20.680186] Possible unsafe locking scenario: > [ 20.680186] > [ 20.680186] CPU0 > [ 20.680186] ---- > [ 20.680186] lock(key#3); > [ 20.680186] > [ 20.680186] lock(key#3); > [ 20.680186] > [ 20.680186] *** DEADLOCK *** > [ 20.680186] > [ 20.680186] 2 locks held by rcu_torture_rea/2493: > [ 20.680186] #0: (rcu_read_lock){.+.+..}, at: [] rcu_torture_read_lock+0x0/0x80 > [ 20.680186] #1: (mm/page-writeback.c:144){+.-...}, at: [] call_timer_fn+0x0/0x260 > [ 20.680186] > [ 20.680186] stack backtrace: > [ 20.680186] Pid: 2493, comm: rcu_torture_rea Tainted: G W 3.4.0-next-20120528-sasha-00008-g11ef39f #307 > [ 20.680186] Call Trace: > [ 20.680186] [] print_usage_bug+0x1a9/0x1d0 > [ 20.680186] [] ? check_usage_forwards+0xf0/0xf0 > [ 20.680186] [] mark_lock_irq+0xc9/0x270 > [ 20.680186] [] mark_lock+0x11d/0x200 > [ 20.680186] [] mark_irqflags+0xf0/0x170 > [ 20.680186] [] __lock_acquire+0x2bb/0x4c0 > [ 20.680186] [] lock_acquire+0x18a/0x1e0 > [ 20.680186] [] ? __percpu_counter_sum+0x17/0xc0 > [ 20.680186] [] ? laptop_io_completion+0x30/0x30 > [ 20.680186] [] _raw_spin_lock+0x3b/0x70 > [ 20.680186] [] ? __percpu_counter_sum+0x17/0xc0 > [ 20.680186] [] __percpu_counter_sum+0x17/0xc0 > [ 20.680186] [] ? init_timer_deferrable_key+0x20/0x20 > [ 20.680186] [] fprop_new_period+0x12/0x60 > [ 20.680186] [] writeout_period+0x3d/0xa0 > [ 20.680186] [] call_timer_fn+0x12f/0x260 > [ 20.680186] [] ? init_timer_deferrable_key+0x20/0x20 > [ 20.680186] [] ? _raw_spin_unlock_irq+0x2b/0x80 > [ 20.680186] [] ? laptop_io_completion+0x30/0x30 > [ 20.680186] [] run_timer_softirq+0x29e/0x2f0 > [ 20.680186] [] __do_softirq+0x221/0x460 > [ 20.680186] [] ? kvm_clock_read+0x46/0x80 > [ 20.680186] [] call_softirq+0x1c/0x30 > [ 20.680186] [] do_softirq+0x75/0x120 > [ 20.680186] [] irq_exit+0x5b/0xf0 > [ 20.680186] [] smp_apic_timer_interrupt+0x8a/0xa0 > [ 20.680186] [] apic_timer_interrupt+0x6f/0x80 > [ 20.680186] [] ? lock_acquire+0x1be/0x1e0 > [ 20.680186] [] ? rcu_torture_reader+0x380/0x380 > [ 20.680186] [] rcu_torture_read_lock+0x33/0x80 > [ 20.680186] [] ? rcu_torture_reader+0x380/0x380 > [ 20.680186] [] rcu_torture_reader+0x123/0x380 > [ 20.680186] [] ? T.841+0x50/0x50 > [ 20.680186] [] ? rcu_torture_read_unlock+0x60/0x60 > [ 20.680186] [] kthread+0xb2/0xc0 > [ 20.680186] [] kernel_thread_helper+0x4/0x10 > [ 20.680186] [] ? retint_restore_args+0x13/0x13 > [ 20.680186] [] ? __init_kthread_worker+0x70/0x70 > [ 20.680186] [] ? gs_change+0x13/0x13 > -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org