From patchwork Tue Mar 22 12:53:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel@kyup.com X-Patchwork-Id: 8642031 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2AD1C9F294 for ; Tue, 22 Mar 2016 12:53:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4845320398 for ; Tue, 22 Mar 2016 12:53:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CD262025B for ; Tue, 22 Mar 2016 12:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758640AbcCVMxp (ORCPT ); Tue, 22 Mar 2016 08:53:45 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:34728 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbcCVMxh (ORCPT ); Tue, 22 Mar 2016 08:53:37 -0400 Received: by mail-wm0-f48.google.com with SMTP id p65so191216183wmp.1 for ; Tue, 22 Mar 2016 05:53:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sXGCbqBDKO0n3zCVXocHkgW86zsafMgITbOVGR3AtOQ=; b=Svt+qkQ/J9hc7059ihtZOY8jVGN/AUnCrbyTPWjgMXTVSIS8Ad6kjcvssNySuxJlhg UcfIcb+2VzMqd27PLA3RTcPQZIS+0IQEuyK6ACV6Aaqrf6Wr5EUkBuO9cOCf/gHtmKN2 ixd2vLlGmHBUrdyfhuUj2nWEldxRmcrFJ0J8ItZjsCh02XmSNXY0f1K+nq8BJAoZ8ZjO Fq+KOfSGkTQQ6P5MgR6/HeB+2knb/IFQbNMJgd32P6HootHfE8+mCS7AnyJItWET/9/3 0TL92ww3KtnNBH2eGXfBkRO3OJEijqC9Y7yt0PmOKLVrqZuHmCkx2XimxxfkftQnKojk 9OQw== X-Gm-Message-State: AD7BkJKR/sfBHwpTPPwZmeFnyztBtINz/vRmM0mIY43O+pZ6c1wg4mjpA47rG2jBBga/OZ1p X-Received: by 10.194.112.34 with SMTP id in2mr40088067wjb.160.1458651212011; Tue, 22 Mar 2016 05:53:32 -0700 (PDT) Received: from localhost.localdomain (admins.1h.com. [82.118.240.130]) by smtp.gmail.com with ESMTPSA id wr2sm30188117wjc.49.2016.03.22.05.53.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Mar 2016 05:53:31 -0700 (PDT) From: Nikolay Borisov To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] dcache: give a chance to yield in shrink_dentry_list Date: Tue, 22 Mar 2016 14:53:28 +0200 Message-Id: <1458651208-25940-1-git-send-email-kernel@kyup.com> X-Mailer: git-send-email 1.7.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A softlockup in shrink_dentry_list when called from shrink_dcache_sb was observed on a very busy server. It's possible that the list passed to shrink_dentry_list is so big that it takes a while to dispose of all entries. Adding a simple cond_resched would give the cpu a chance to do some other useful work and no trip the softlockup watchdog. Signed-off-by: Nikolay Borisov --- Here is what the splat looked like. Even though this was observed on a 3.12 kernel I don't see why it can't happen on recent kernels as well. [1294411.570734] BUG: soft lockup - CPU#3 stuck for 22s! [mount:33726] [1294411.571005] Modules linked in: xt_comment ipip tunnel4 ip6_tunnel tunnel6 tcp_diag inet_diag xt_time act_police cls_basic sch_ingress hijack(O) netconsole xt_multiport xt_pkttype ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state veth openvswitch gre vxlan ip_tunnel xt_owner xt_conntrack iptable_mangle xt_nat iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat xt_CT nf_conntrack iptable_raw ip6table_filter ip6_tables ipv6 ext2 dm_thin_pool dm_bio_prison dm_persistent_data dm_bufio dm_mirror dm_region_hash dm_log ib_ipoib ib_cm ib_sa ib_mad ib_core ixgbe i2c_i801 lpc_ich mfd_core ioapic ioatdma igb dca i2c_algo_bit [last unloaded: ipmi_msghandler] [1294411.571047] CPU: 3 PID: 33726 Comm: mount Tainted: G O 3.12.52-clouder2 #1 [1294411.571048] Hardware name: Supermicro X9DRD-7LN4F(-JBOD)/X9DRD-EF/X9DRD-7LN4F, BIOS 3.0a 12/05/2013 [1294411.571050] task: ffff8833c55f9830 ti: ffff883fcfcf6000 task.ti: ffff883fcfcf6000 [1294411.571051] RIP: 0010:[] [] __d_drop+0x60/0xf0 [1294411.571056] RSP: 0018:ffff883fcfcf7d38 EFLAGS: 00000206 [1294411.571057] RAX: ffffc9000b101770 RBX: ffff881fff8cc6a0 RCX: 0000000000000007 [1294411.571058] RDX: ffff883fcfcf6000 RSI: 0000000000000000 RDI: ffff8805bd5063c0 [1294411.571058] RBP: ffff883fcfcf7d38 R08: 0000000000000073 R09: 0000000000000000 [1294411.571059] R10: 7fffffffffffffff R11: 0000000000000000 R12: ffff8805bd506530 [1294411.571060] R13: ffff883fcfcf7cc8 R14: 0000000000000000 R15: ffff881fff8cc6a0 [1294411.571061] FS: 00007f0321cca7e0(0000) GS:ffff881fff8c0000(0000) knlGS:0000000000000000 [1294411.571062] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [1294411.571063] CR2: 00007f0320d7e0c0 CR3: 0000001e050f6000 CR4: 00000000001407e0 [1294411.571063] Stack: [1294411.571064] ffff883fcfcf7d68 ffffffff811c3372 0000000000000202 ffff8805bd5063c0 [1294411.571068] ffff8805bd506440 ffff881fd0c9ec00 ffff883fcfcf7dd8 ffffffff811c36e6 [1294411.571070] 0000000000000001 ffff883fcfcf7df8 ffff883fcfcf6000 ffff883fcfcf6000 [1294411.571073] Call Trace: [1294411.571078] [] __dentry_kill+0x62/0x210 [1294411.571080] [] shrink_dentry_list+0x1c6/0x390 [1294411.571082] [] shrink_dcache_sb+0xcb/0x110 [1294411.571086] [] do_remount_sb+0x4a/0x190 [1294411.571089] [] do_mount+0xaf0/0xd20 [1294411.571091] [] SyS_mount+0x97/0xf0 [1294411.571095] [] system_call_fastpath+0x16/0x1b fs/dcache.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/dcache.c b/fs/dcache.c index 2398f9f94337..0db355a50bc5 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -934,6 +934,9 @@ static void shrink_dentry_list(struct list_head *list) while (!list_empty(list)) { struct inode *inode; + + cond_resched(); + dentry = list_entry(list->prev, struct dentry, d_lru); spin_lock(&dentry->d_lock); parent = lock_parent(dentry);