Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2028660pxa; Mon, 24 Aug 2020 03:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzECqCdYo0YPjJaT9okD9oQNRoEWO080Ko6CIoF+s1NG817J1zGBzOmbNY0iTLml9IzfzcO X-Received: by 2002:a17:906:4a07:: with SMTP id w7mr5044305eju.515.1598263460278; Mon, 24 Aug 2020 03:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598263460; cv=none; d=google.com; s=arc-20160816; b=WhItdCWpx51eqcIeSCp9B7ldCEElCKicnpO05PDPP8E5722xIsHqQJ+yo4++6OWcgT a2St+LxDVaIS+e9ZSt6hUCNPMqT0tZMOH+WKcQ9/lZAWY+HiAc/yB/NXi3CUf7jF61QR 37+7a8KFTrkMqmcO+hPaLuj8zHkK14MGRtkJpJBM4ae95s2KdndQqbF6N5x3TBNyU81m C724s1gOIe7RGeWZPjl0zmVBxq83igr1/8BjPiWIrqC+76LruJg4oUGThpU4EHd/31xB DWRGqhUOQt6ksUnWa1snBYNS4vM4nnjmTTqbsXFHKaD5Q4ffLJbNPXiQdr6yfs1dfEzW bARg== 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=nDSTrQIfs6X1HsUZjsdDov3T/xG2XYFyYFPI0ieQatg=; b=P1/pvDQ9ibaHITZnNUWCOjlbc3d4AUXQL6YMYNh/8B9BMhUzP1Lfdyw1HymlBF2a7I 7urnjYmE5E2N1VSVE3Bu9kLTnXFY3mnOSg7x3/ILuW/x/A+aebA7yenSiUq1hiP7r3mW evZUd5PLhpBLqrPHrtPjos3ymzCbs/EcVjIp8uIGEaLnpoTEnZ8ifoWhYjZEIz2F11cg 3G4jQV2G8vsdrh9fJdNSff7SmN2B/qW88lrRnWuicOueJhMg7ZOAgOWjWObcj7Qx9YDG 3GA6kXWhTNguKLSEeLOlwbW4Pm1ALLp4Lc0vxLdp9Y1Gzx9qxoULFh81urtD+fs3q9Dj kOjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPcfbZhy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si3733345edq.385.2020.08.24.03.03.57; Mon, 24 Aug 2020 03:04:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPcfbZhy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgHXIcS (ORCPT + 99 others); Mon, 24 Aug 2020 04:32:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:38822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbgHXIcM (ORCPT ); Mon, 24 Aug 2020 04:32:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 81D2F2075B; Mon, 24 Aug 2020 08:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598257932; bh=r9frgyjhWWsV5D7gVd3roTJ9g0wLQqxo9jGzikBxuWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPcfbZhynu4c3brrLzqkH1LuwkvXgCr2f1doZPmmldmLoIfQTg1HQ3lIx3zcWtQxw /vwE+6Vdkw/vax5UnME/qmltUkGfX98kcnVkmJxL5KZUbLbprViSCteBdr5LqhkWkm u3sj0vryKQETg5D1aoZcENhcjmi4f4pDFY8UmWGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harish Sriram , "Aneesh Kumar K.V" , Andrew Morton , Linus Torvalds Subject: [PATCH 5.8 013/148] mm/vunmap: add cond_resched() in vunmap_pmd_range Date: Mon, 24 Aug 2020 10:28:31 +0200 Message-Id: <20200824082414.598438843@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082413.900489417@linuxfoundation.org> References: <20200824082413.900489417@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Aneesh Kumar K.V commit e47110e90584a22e9980510b00d0dfad3a83354e upstream. Like zap_pte_range add cond_resched so that we can avoid softlockups as reported below. On non-preemptible kernel with large I/O map region (like the one we get when using persistent memory with sector mode), an unmap of the namespace can report below softlockups. 22724.027334] watchdog: BUG: soft lockup - CPU#49 stuck for 23s! [ndctl:50777] NIP [c0000000000dc224] plpar_hcall+0x38/0x58 LR [c0000000000d8898] pSeries_lpar_hpte_invalidate+0x68/0xb0 Call Trace: flush_hash_page+0x114/0x200 hpte_need_flush+0x2dc/0x540 vunmap_page_range+0x538/0x6f0 free_unmap_vmap_area+0x30/0x70 remove_vm_area+0xfc/0x140 __vunmap+0x68/0x270 __iounmap.part.0+0x34/0x60 memunmap+0x54/0x70 release_nodes+0x28c/0x300 device_release_driver_internal+0x16c/0x280 unbind_store+0x124/0x170 drv_attr_store+0x44/0x60 sysfs_kf_write+0x64/0x90 kernfs_fop_write+0x1b0/0x290 __vfs_write+0x3c/0x70 vfs_write+0xd8/0x260 ksys_write+0xdc/0x130 system_call+0x5c/0x70 Reported-by: Harish Sriram Signed-off-by: Aneesh Kumar K.V Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Cc: Link: http://lkml.kernel.org/r/20200807075933.310240-1-aneesh.kumar@linux.ibm.com Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/vmalloc.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -102,6 +102,8 @@ static void vunmap_pmd_range(pud_t *pud, if (pmd_none_or_clear_bad(pmd)) continue; vunmap_pte_range(pmd, addr, next, mask); + + cond_resched(); } while (pmd++, addr = next, addr != end); }