From patchwork Wed Dec 11 16:58:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vrabel X-Patchwork-Id: 3327341 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03D0F9F37A for ; Wed, 11 Dec 2013 16:58:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF56A20806 for ; Wed, 11 Dec 2013 16:58:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22E8620804 for ; Wed, 11 Dec 2013 16:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475Ab3LKQ6X (ORCPT ); Wed, 11 Dec 2013 11:58:23 -0500 Received: from smtp.citrix.com ([66.165.176.89]:17047 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996Ab3LKQ6W (ORCPT ); Wed, 11 Dec 2013 11:58:22 -0500 X-IronPort-AV: E=Sophos;i="4.93,872,1378857600"; d="scan'208";a="83302514" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 11 Dec 2013 16:58:21 +0000 Received: from [10.80.2.76] (10.80.2.76) by FTLPEX01CL01.citrite.net (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Wed, 11 Dec 2013 11:58:20 -0500 Message-ID: <52A899AB.3010506@citrix.com> Date: Wed, 11 Dec 2013 16:58:19 +0000 From: David Vrabel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20121215 Iceowl/1.0b1 Icedove/3.0.11 MIME-Version: 1.0 To: Andrew Morton CC: "linux-kernel@vger.kernel.org" , Len Brown , "Rafael J. Wysocki" , , xen-devel , Dietmar Hahn Subject: vunmap() on large regions may trigger soft lockup warnings X-Originating-IP: [10.80.2.76] X-DLP: MIA2 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Andrew, Dietmar Hahn reported an issue where calling vunmap() on a large (50 GB) region would trigger soft lockup warnings. The following patch would resolve this (by adding a cond_resched() call to vunmap_pmd_range()). Almost calls of vunmap(), unmap_kernel_range() are from process context (as far as I could tell) except for an ACPI driver (drivers/acpi/apei/ghes.c) calls unmap_kernel_range_noflush() from an interrupt and NMI contexts. Can you advise on a preferred solution? For example, an unmap_kernel_page() function (callable from atomic context) could be provided since the GHES driver only maps/unmaps a single page. 8<------------------------- mm/vmalloc: avoid soft lockup warnings when vunmap()'ing large ranges From: David Vrabel If vunmap() is used to unmap a large (e.g., 50 GB) region, it may take sufficiently long that it triggers soft lockup warnings. Add a cond_resched() into vunmap_pmd_range() so the calling task may be resheduled after unmapping each PMD entry. This is how zap_pmd_range() fixes the same problem for userspace mappings. Reported-by: Dietmar Hahn Signed-off-by: David Vrabel --- mm/vmalloc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0fdf968..b1b5b39 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -75,6 +75,7 @@ static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end) if (pmd_none_or_clear_bad(pmd)) continue; vunmap_pte_range(pmd, addr, next); + cond_resched(); } while (pmd++, addr = next, addr != end); }