Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbbGWXdW (ORCPT ); Thu, 23 Jul 2015 19:33:22 -0400 Received: from g4t3427.houston.hp.com ([15.201.208.55]:55613 "EHLO g4t3427.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752345AbbGWXdT (ORCPT ); Thu, 23 Jul 2015 19:33:19 -0400 Message-ID: <1437694323.3214.353.camel@hp.com> Subject: Re: [PATCH] mm: add resched points to remap_pmd_range/ioremap_pmd_range From: Toshi Kani To: Spencer Baugh , Andrew Morton , Fengguang Wu , Joern Engel , "Kirill A. Shutemov" , Mel Gorman , Johannes Weiner , Michal Hocko , Shachar Raindel , Boaz Harrosh , Andy Lutomirski , Joonsoo Kim , Andrey Ryabinin , Roman Pen , Andrey Konovalov , Eric Dumazet , Dmitry Vyukov , Rob Jones , WANG Chao , open list , "open list:MEMORY MANAGEMENT" Cc: Joern Engel , Spencer Baugh Date: Thu, 23 Jul 2015 17:32:03 -0600 In-Reply-To: <1437688476-3399-3-git-send-email-sbaugh@catern.com> References: <1437688476-3399-3-git-send-email-sbaugh@catern.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.3 (3.16.3-2.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6604 Lines: 139 On Thu, 2015-07-23 at 14:54 -0700, Spencer Baugh wrote: > From: Joern Engel > > Mapping large memory spaces can be slow and prevent high-priority > realtime threads from preempting lower-priority threads for a long time. Yes, and one of the goals of large page ioremap support is to address such problem. > In my case it was a 256GB mapping causing at least 950ms scheduler > delay. Problem detection is ratelimited and depends on interrupts > happening at the right time, so actual delay is likely worse. ioremap supports 1GB and 2MB mappings now. If you create 1GB mappings, you only need to initialize 256 pud entries, which should not take a long time. Is the 256GB range aligned by 1GB (or 2MB)? From the log below, it appears that you ended up with 4KB mappings, which is the problem. > ------------[ cut here ]------------ > WARNING: at arch/x86/kernel/irq.c:182 do_IRQ+0x126/0x140() > Thread not rescheduled for 36 jiffies > CPU: 14 PID: 6684 Comm: foo Tainted: G O 3.10.59+ > 0000000000000009 ffff883f7fbc3ee0 ffffffff8163a12c ffff883f7fbc3f18 > ffffffff8103f131 ffff887f48275ac0 0000000000000012 000000000000007c > 0000000000000000 ffff887f5bc11fd8 ffff883f7fbc3f78 ffffffff8103f19c > Call Trace: > [] dump_stack+0x19/0x1b > [] warn_slowpath_common+0x61/0x80 > [] warn_slowpath_fmt+0x4c/0x50 > [] ? rcu_irq_exit+0x77/0xc0 > [] do_IRQ+0x126/0x140 > [] common_interrupt+0x6f/0x6f > [] ? set_pageblock_migratetype+0x28/0x30 > [] ? clear_page_c_e+0x7/0x10 > [] ? get_page_from_freelist+0x5b3/0x880 > [] __alloc_pages_nodemask+0xe3/0x810 > [] ? trace_hardirqs_on_thunk+0x3a/0x3c > [] alloc_pages_current+0x86/0x120 > [] __get_free_pages+0xe/0x50 > [] pte_alloc_one_kernel+0x15/0x20 > [] __pte_alloc_kernel+0x1d/0xf0 This shows that you created 4KB (pte) mappings. > [] ioremap_page_range+0x2cc/0x320 > [] __ioremap_caller+0x1e9/0x2b0 > [] ioremap_nocache+0x17/0x20 > [] pci_iomap+0x55/0xb0 > [] vfio_pci_mmap+0x1ea/0x210 [vfio_pci] > [] vfio_device_fops_mmap+0x23/0x30 [vfio] > [] mmap_region+0x3d8/0x5e0 > [] do_mmap_pgoff+0x305/0x3c0 > [] ? call_rwsem_down_write_failed+0x13/0x20 > [] vm_mmap_pgoff+0x67/0xa0 > [] SyS_mmap_pgoff+0x272/0x2e0 > [] SyS_mmap+0x22/0x30 > [] system_call_fastpath+0x16/0x1b > ---[ end trace 6b0a8d2341444bdd ]--- > ------------[ cut here ]------------ > WARNING: at arch/x86/kernel/irq.c:182 do_IRQ+0x126/0x140() > Thread not rescheduled for 95 jiffies > CPU: 14 PID: 6684 Comm: foo Tainted: G W O 3.10.59+ > 0000000000000009 ffff883f7fbc3ee0 ffffffff8163a12c ffff883f7fbc3f18 > ffffffff8103f131 ffff887f48275ac0 000000000000002f 000000000000007c > 0000000000000000 00007fadd1e00000 ffff883f7fbc3f78 ffffffff8103f19c > Call Trace: > [] dump_stack+0x19/0x1b > [] warn_slowpath_common+0x61/0x80 > [] warn_slowpath_fmt+0x4c/0x50 > [] ? rcu_irq_exit+0x77/0xc0 > [] do_IRQ+0x126/0x140 > [] common_interrupt+0x6f/0x6f > [] ? _raw_spin_lock+0x13/0x30 > [] __pte_alloc+0x31/0xc0 > [] remap_pfn_range+0x45c/0x470 remap_pfn_range() does not have large page mappings support yet. So, yes, this can still take a long time at this point. We can extend large page support for this interface if necessary. > [] vfio_pci_mmap+0x148/0x210 [vfio_pci] > [] vfio_device_fops_mmap+0x23/0x30 [vfio] > [] mmap_region+0x3d8/0x5e0 > [] do_mmap_pgoff+0x305/0x3c0 > [] ? call_rwsem_down_write_failed+0x13/0x20 > [] vm_mmap_pgoff+0x67/0xa0 > [] SyS_mmap_pgoff+0x272/0x2e0 > [] SyS_mmap+0x22/0x30 > [] system_call_fastpath+0x16/0x1b > ---[ end trace 6b0a8d2341444bde ]--- > ------------[ cut here ]------------ > WARNING: at arch/x86/kernel/irq.c:182 do_IRQ+0x126/0x140() > Thread not rescheduled for 45 jiffies > CPU: 18 PID: 21726 Comm: foo Tainted: G O 3.10.59+ > 0000000000000009 ffff88203f203ee0 ffffffff8163a13c ffff88203f203f18 > ffffffff8103f131 ffff881ec5f1ad60 0000000000000016 000000000000006e > 0000000000000000 ffffc939a6dd8000 ffff88203f203f78 ffffffff8103f19c > Call Trace: > [] dump_stack+0x19/0x1b > [] warn_slowpath_common+0x61/0x80 > [] warn_slowpath_fmt+0x4c/0x50 > [] ? rcu_irq_exit+0x77/0xc0 > [] do_IRQ+0x126/0x140 > [] common_interrupt+0x6f/0x6f > [] ? retint_restore_args+0x13/0x13 > [] ? free_memtype+0x87/0x150 > [] ? vunmap_page_range+0x1e6/0x2a0 > [] remove_vm_area+0x51/0x70 > [] iounmap+0x67/0xa0 iounmap() should be fast if you created 1GB mappings. Thanks, -Toshi > [] pci_iounmap+0x35/0x40 > [] vfio_pci_release+0x9a/0x150 [vfio_pci] > [] vfio_device_fops_release+0x1c/0x40 [vfio] > [] __fput+0xdb/0x220 > [] ____fput+0xe/0x10 > [] task_work_run+0xbc/0xe0 > [] do_exit+0x3ce/0xe50 > [] do_group_exit+0x3f/0xa0 > [] get_signal_to_deliver+0x1a9/0x5b0 > [] do_signal+0x48/0x5e0 > [] ? k_getrusage+0x368/0x3d0 > [] ? default_wake_function+0x12/0x20 > [] ? kprobe_flush_task+0xc0/0x150 > [] ? finish_task_switch+0xc4/0xe0 > [] do_notify_resume+0x65/0x80 > [] retint_signal+0x4d/0x9f > ---[ end trace 3506c05e4a0af3e5 ]--- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/