Message ID | 20181211084609.19553-1-ying.huang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB5E391E for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Dec 2018 08:46:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6F152A51C for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Dec 2018 08:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97AD92A52A; Tue, 11 Dec 2018 08:46:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F9002A51C for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Dec 2018 08:46:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C6CE8E005D; Tue, 11 Dec 2018 03:46:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6748B8E004D; Tue, 11 Dec 2018 03:46:21 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5193D8E005D; Tue, 11 Dec 2018 03:46:21 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id F2F238E004D for <linux-mm@kvack.org>; Tue, 11 Dec 2018 03:46:20 -0500 (EST) Received: by mail-pg1-f199.google.com with SMTP id o9so9363699pgv.19 for <linux-mm@kvack.org>; Tue, 11 Dec 2018 00:46:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=gvo2LxMZWkljyIAiEOEqg7/axz2AQWt5UQMad2uBvgg=; b=AX8UdMAyBbBbCWWiaqrKA7M6Q8j5I5ZDTPIa8Vcubfj0OGj9bfvdxuXP/qW2IPzbKg MH7YM6YnJhJKhcczBKVawY334PvOypTvsORkKmJZXp8DDPfZ+7zjIMcSNMjPahA3kssG NcZT5NYnAX0CBnucma0GmIyluzzcpjHlsyRBM7CMh8tXT80b4bZspxHdqX0D1xefTa8H yi5pWFr8RJT5vQ7kXBpyG2izYI7YXWr+mesLW+/CPK6MXEGQv7jhWDtIrqNcoxG6Oi3J O00dPrKBF8h8ZpEwwrAnB0shT0mJ6JRyTySn6Fxuc+0G1yUSKgitCni+yprDfPgjeoKe Vq/A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AA+aEWaJebOXi/k8wC/1FJshIxsTZZsrph0zOZlexeG0hn4n5t3qLDy9 xBX6oRUSGd2hyx1q16TDFyw2UZcsxg2MxWOJTyOzS0oSCivIYnwLmqo9d/aBO9FrQW9vbUSPh9M 4G/EDTew0rT9NdeSYBOQDdLq7lTV3IAY2Z0IO2qb49/sTBN5GAZiUQHiEb4QkJ+Xa5w== X-Received: by 2002:a63:580a:: with SMTP id m10mr13660034pgb.332.1544517980504; Tue, 11 Dec 2018 00:46:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/VPxnEAZ46xWB0JHI9DM5wKWDDt7VLbaXcyW682mnR9IbXhniNlpjzQI9tL0mxHvk8LJvtB X-Received: by 2002:a63:580a:: with SMTP id m10mr13659983pgb.332.1544517979126; Tue, 11 Dec 2018 00:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544517979; cv=none; d=google.com; s=arc-20160816; b=PYvBS0JJdTf/atl13KjLQxB4B7g1KVrK6UIteyhiOT1mGLWdOVuVEGzvvwTAHc1p4w wOwIMDOsknTDFCNyPnqukTmSdjQNoOozVLUb1Y+CEwVhNNkjgJcFarSKnYb2jOlqCHbu Bigsiv8AIW2uXqkaCtGD0t7qjN0mCDoPNj9zVpagizgCc46Rwox7Z1gJfnLyfDcRgJrN g38wEOnMieAc5daNLuLXNUyr+g0gXT2WMvzi8QZYCGjJbvyTEuCJX5xU4bf5UccBQxqG ugE4VjYFcIuD7ZjfUxECeQ4bPiNqyL1t615BCxltHaUdz6iMGqccQdUAVXhtPTwSWF5m L9+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=gvo2LxMZWkljyIAiEOEqg7/axz2AQWt5UQMad2uBvgg=; b=DPKTtRgY69sEi7V8QHD9hXEDPye/luNSvTWwivu/1+su98ZOnTlhfA9ptnnk/9A3PN SO5KpzisXHpUqADwJMxYG4/N8gYhwDl2J1QWddii2Oef+yWYRqf6XHecvrx3Cc0Ad1iF 18VGrxQK6rl1TWUScgQ0iNNTE3zSKJAYBqzGuiEkq0iaZFNaAJCR93Xd9cqLAqICOuaV lRGG7Uqp25q8+6Q+e7XMlRacVscElnZ6FUscd+fq9tCWiy70yNTstXQpnDiBteD5yqxq NnrDsxjS2HPCIchmHAPuX3GpYaPVg9GRHwuZ4CxIkW8W8WEIb4oWUAs0dLgXPHXMoX8r Tc9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id d2si12797074pfe.159.2018.12.11.00.46.18 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 00:46:19 -0800 (PST) Received-SPF: pass (google.com: domain of ying.huang@intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ying.huang@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 00:46:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,341,1539673200"; d="scan'208";a="106520746" Received: from yhuang-mobile.sh.intel.com ([10.239.192.61]) by fmsmga007.fm.intel.com with ESMTP; 11 Dec 2018 00:46:16 -0800 From: Huang Ying <ying.huang@intel.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying <ying.huang@intel.com>, Vineeth Remanan Pillai <vpillai@digitalocean.com>, Kelley Nielsen <kelleynnn@gmail.com>, Rik van Riel <riel@surriel.com>, Matthew Wilcox <willy@infradead.org>, Hugh Dickins <hughd@google.com> Subject: [PATCH 1/2] swap: Fix general protection fault when swapoff Date: Tue, 11 Dec 2018 16:46:08 +0800 Message-Id: <20181211084609.19553-1-ying.huang@intel.com> X-Mailer: git-send-email 2.18.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
[1/2] swap: Fix general protection fault when swapoff
|
expand
|
diff --git a/mm/swapfile.c b/mm/swapfile.c index 9ca162cc45dc..7464d0a92869 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1904,6 +1904,7 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, swap_map = &si->swap_map[offset]; vmf.vma = vma; vmf.address = addr; + vmf.pmd = pmd; page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, &vmf); if (!page) { if (*swap_map == 0 || *swap_map == SWAP_MAP_BAD)
When VMA based swap readahead is used, which is default if all swap devices are SSD, swapoff will trigger general protection fault as follow, because vmf->pmd isn't initialized when calling swapin_readahead(). This fix could be folded into the patch: mm, swap: rid swapoff of quadratic complexity in -mm patchset. general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC CPU: 3 PID: 352 Comm: swapoff Not tainted 4.20.0-rc5-mm1-kvm+ #535 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-1.fc28 04/01/2014 RIP: 0010:swapin_readahead+0xb7/0x39b Code: ff 01 00 00 40 f6 c7 80 49 0f 45 d0 48 21 d7 48 ba 00 00 00 00 80 88 ff ff 48 8d 14 f2 48 01 d7 48 ba ff ff ff ff ff ff ff ef <48> 39 17 0f 87 5d 01 00 00 49 8b 95 b0 00 00 00 48 85 d2 75 05 ba RSP: 0018:ffffc900004c3ca0 EFLAGS: 00010207 RAX: 000055de5d252000 RBX: 000000055de5d252 RCX: 0000000000000003 RDX: efffffffffffffff RSI: 0000000000000052 RDI: 000f0bc11c600290 RBP: ffffc900004c3d30 R08: 000fffffffe00000 R09: ffffc900004c3ea0 R10: ffffc900004c3d50 R11: 0000000000000002 R12: ffffc900004c3da8 R13: ffff88803b71d780 R14: 0000000000000001 R15: ffff88803b71d780 FS: 00007f87c20e02c0(0000) GS:ffff88803e800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055a439825398 CR3: 000000003b49a004 CR4: 0000000000360ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? list_add_tail_rcu+0x19/0x31 ? __lock_acquire+0xd61/0xe1c ? find_held_lock+0x2b/0x6e ? unuse_pte_range+0xe9/0x429 unuse_pte_range+0xe9/0x429 ? find_held_lock+0x2b/0x6e ? __lock_is_held+0x40/0x71 try_to_unuse+0x311/0x54b __do_sys_swapoff+0x254/0x625 ? lockdep_hardirqs_off+0x29/0x86 ? do_syscall_64+0x12/0x65 do_syscall_64+0x57/0x65 entry_SYSCALL_64_after_hwframe+0x49/0xbe Signed-off-by: "Huang, Ying" <ying.huang@intel.com> Cc: Vineeth Remanan Pillai <vpillai@digitalocean.com> Cc: Kelley Nielsen <kelleynnn@gmail.com> Cc: Rik van Riel <riel@surriel.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Hugh Dickins <hughd@google.com> --- mm/swapfile.c | 1 + 1 file changed, 1 insertion(+)