Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3415679imu; Sun, 11 Nov 2018 14:33:09 -0800 (PST) X-Google-Smtp-Source: AJdET5fTNn0ESiYDEjf3twP+r+RxHu4kJ5fqTfaLCGzDME6ddFyMWElzzVQmyjSEl0QeOhH4oSWW X-Received: by 2002:a62:5904:: with SMTP id n4mr308248pfb.120.1541975588936; Sun, 11 Nov 2018 14:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541975588; cv=none; d=google.com; s=arc-20160816; b=QSqFU2r9/MQ5KxWlSJ/Kiu7cHlH2koQ1xuoZKnorBFSlB243rFXuG1zEIVYiQzcQLX kXgaWG0KyVdcZ3/S4jPAV4QUOGxZ1sj+4n1n1XzlCwPfEF5X+nd6lXyCf8u4TZpYEnpE ONlbsXmQDcwCLzFxmlKeI5u9nGQkUNxMv8z9GpjXStNdg3rzcJZKfGEiye9faXeKO2dJ /Ic1o3nLlLbmhUHZfeJGG93rffm4kiN2utYz8ku1PKcze3ERhyFkhca+xBRZS/E/aHR8 8lg12Ms8H2CBSSQGpEZzA3hLesYV2V87+LU6O8xEKzqtWeRMpcAllc4mmQC/itwgv9HM vK+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VqUMvgi6flw6uu2zO0k/Xg+J4RwON1Nk9EnwjTfMXEI=; b=lIDXKuvQJPsPAliZHWFAEQ7I4cZ3TDSQtaUTviKYmFuCt/sn2dkiqr6jPzhF75U74I OzD+yPc3yDo/C0U1M+8/nh774cfuE8Nc/6WyC2auy89DCT22ixYFPrha4b1g3Y8ReDwj Zqu4NBHKKkk/9nNyuDTXOM4igtr2sG8kAj8tTaNGbDS3jN6Ock3Jie0uRnaU4IMqohOR sOnX6GovijPrbC9ubV30iW8i2z/js9f8GQJ5vplEGcW8cwGtyznVghx/YUywqm13OFoF 7DX8TXCpWrl2ZgisINc8nnkSzCfU96BqfD/kheVqALIxcd/hJgo+Ptr1jw85wqMIx/4z 4w+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dsylR3f6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si1960158pgu.437.2018.11.11.14.32.53; Sun, 11 Nov 2018 14:33:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dsylR3f6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390565AbeKLIWY (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:51200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387727AbeKLIWW (ORCPT ); Mon, 12 Nov 2018 03:22:22 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2FD8B2241E; Sun, 11 Nov 2018 22:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975545; bh=UJfBsZV0kT0VY2Em2Gk1CylxAllrwSMDaTA76cpMzBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsylR3f6o6Ae/mpPMIPkS9zgbLzkSAEOC5c3kOd2y68kjcgs0TCWOBtGMVIY4ceel 2vx2z/ZXPcnAZA0xx/EjLQCxIGVwvrtRcfJMAKduMeCA3PtHpgJljv2Po/kcLOsSdD gqJXjI/ZtVwKgl/KOKkGPxyrCKolokHq1w16IEV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Hocko , Tejun Heo , Sasha Levin Subject: [PATCH 4.14 076/222] cgroup, netclassid: add a preemption point to write_classid Date: Sun, 11 Nov 2018 14:22:53 -0800 Message-Id: <20181111221654.880193377@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Hocko [ Upstream commit a90e90b7d55e789c71d85b946ffb5c1ab2f137ca ] We have seen a customer complaining about soft lockups on !PREEMPT kernel config with 4.4 based kernel [1072141.435366] NMI watchdog: BUG: soft lockup - CPU#21 stuck for 22s! [systemd:1] [1072141.444090] Modules linked in: mpt3sas raid_class binfmt_misc af_packet 8021q garp mrp stp llc xfs libcrc32c bonding iscsi_ibft iscsi_boot_sysfs msr ext4 crc16 jbd2 mbcache cdc_ether usbnet mii joydev hid_generic usbhid intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel ipmi_ssif mgag200 i2c_algo_bit ttm ipmi_devintf drbg ixgbe drm_kms_helper vxlan ansi_cprng ip6_udp_tunnel drm aesni_intel udp_tunnel aes_x86_64 iTCO_wdt syscopyarea ptp xhci_pci lrw iTCO_vendor_support pps_core gf128mul ehci_pci glue_helper sysfillrect mdio pcspkr sb_edac ablk_helper cryptd ehci_hcd sysimgblt xhci_hcd fb_sys_fops edac_core mei_me lpc_ich ses usbcore enclosure dca mfd_core ipmi_si mei i2c_i801 scsi_transport_sas usb_common ipmi_msghandler shpchp fjes wmi processor button acpi_pad btrfs xor raid6_pq sd_mod crc32c_intel megaraid_sas sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua scsi_mod md_mod autofs4 [1072141.444146] Supported: Yes [1072141.444149] CPU: 21 PID: 1 Comm: systemd Not tainted 4.4.121-92.80-default #1 [1072141.444150] Hardware name: LENOVO Lenovo System x3650 M5 -[5462P4U]- -[5462P4U]-/01GR451, BIOS -[TCE136H-2.70]- 06/13/2018 [1072141.444151] task: ffff880191bd0040 ti: ffff880191bd4000 task.ti: ffff880191bd4000 [1072141.444153] RIP: 0010:[] [] update_classid_sock+0x29/0x40 [1072141.444157] RSP: 0018:ffff880191bd7d58 EFLAGS: 00000286 [1072141.444158] RAX: ffff883b177cb7c0 RBX: 0000000000000000 RCX: 0000000000000000 [1072141.444159] RDX: 00000000000009c7 RSI: ffff880191bd7d5c RDI: ffff8822e29bb200 [1072141.444160] RBP: ffff883a72230980 R08: 0000000000000101 R09: 0000000000000000 [1072141.444161] R10: 0000000000000008 R11: f000000000000000 R12: ffffffff815229d0 [1072141.444162] R13: 0000000000000000 R14: ffff881fd0a47ac0 R15: ffff880191bd7f28 [1072141.444163] FS: 00007f3e2f1eb8c0(0000) GS:ffff882000340000(0000) knlGS:0000000000000000 [1072141.444164] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [1072141.444165] CR2: 00007f3e2f200000 CR3: 0000001ffea4e000 CR4: 00000000001606f0 [1072141.444166] Stack: [1072141.444166] ffffffa800000246 00000000000009c7 ffffffff8121d583 ffff8818312a05c0 [1072141.444168] ffff8818312a1100 ffff880197c3b280 ffff881861422858 ffffffffffffffea [1072141.444170] ffffffff81522b1c ffffffff81d0ca20 ffff8817fa17b950 ffff883fdd8121e0 [1072141.444171] Call Trace: [1072141.444179] [] iterate_fd+0x53/0x80 [1072141.444182] [] write_classid+0x4c/0x80 [1072141.444187] [] cgroup_file_write+0x9b/0x100 [1072141.444193] [] kernfs_fop_write+0x11b/0x150 [1072141.444198] [] __vfs_write+0x26/0x100 [1072141.444201] [] vfs_write+0x9d/0x190 [1072141.444203] [] SyS_write+0x42/0xa0 [1072141.444207] [] entry_SYSCALL_64_fastpath+0x1e/0xca [1072141.445490] DWARF2 unwinder stuck at entry_SYSCALL_64_fastpath+0x1e/0xca If a cgroup has many tasks with many open file descriptors then we would end up in a large loop without any rescheduling point throught the operation. Add cond_resched once per task. Signed-off-by: Michal Hocko Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/core/netclassid_cgroup.c | 1 + 1 file changed, 1 insertion(+) --- a/net/core/netclassid_cgroup.c +++ b/net/core/netclassid_cgroup.c @@ -106,6 +106,7 @@ static int write_classid(struct cgroup_s iterate_fd(p->files, 0, update_classid_sock, (void *)(unsigned long)cs->classid); task_unlock(p); + cond_resched(); } css_task_iter_end(&it);