From patchwork Thu Jan 16 03:01:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11335911 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7610E138D for ; Thu, 16 Jan 2020 03:03:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4357124656 for ; Thu, 16 Jan 2020 03:03:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eIDG2Xqu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4357124656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 61A8F8E001E; Wed, 15 Jan 2020 22:03:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5CAAC8E001C; Wed, 15 Jan 2020 22:03:41 -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 4B8F78E001E; Wed, 15 Jan 2020 22:03:41 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 378018E001C for ; Wed, 15 Jan 2020 22:03:41 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 10D022C1E for ; Thu, 16 Jan 2020 03:03:41 +0000 (UTC) X-FDA: 76382002242.26.rake97_776c61a529f39 X-Spam-Summary: 2,0,0,433a81733e094eae,d41d8cd98f00b204,kernelfans@gmail.com,::kernelfans@gmail.com:akpm@linux-foundation.org:david@redhat.com:dan.j.williams@intel.com:osalvador@suse.de:mhocko@kernel.org:kexec@lists.infradead.org:k-hagio@ab.jp.nec.com,RULES_HIT:41:355:379:541:800:960:968:973:981:988:989:1260:1345:1431:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3871:3872:3874:4321:5007:6261:6653:7514:7903:9413:10004:10241:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13161:13229:13311:13357:13846:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21795:21990:30051:30054:30064:30070,0,RBL:209.85.214.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: rake97_776c61a529f39 X-Filterd-Recvd-Size: 4117 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jan 2020 03:03:40 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id s21so7698386plr.7 for ; Wed, 15 Jan 2020 19:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NJlj509WrrQAYExVBbW6kNqKcDZkIxwdTMPkSzlPl60=; b=eIDG2XquDRZXR6AZX46xIzm/uge8ctQ5iQ2A3jntmM5LyyoiSAJ13nA7n1IB2cuktg wmqvKY4uIjhHOOcn8lOQC5gWQTMGGXJD660T8LvvedpAVOjsXph94dwzd/QVPT8rLwP0 I1WzVm5WIOadjcuSC4+z+EJGblEsUzv61r00zTKFENhyMkU2dqnMt/wj6+bxPB6pIMOQ XFuFX17h+mPHpyRegex7aFBcBXQw5e/D3Q6k6Da25/B6J9kORlVIhTnd9zz/XrNzW5b2 IHz+6YzHje0EKMeDSzQhnpi823+zGC/DPcsmeFWwWOtvCG88zpX4k5UyhAN87KIIWFMT vw9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NJlj509WrrQAYExVBbW6kNqKcDZkIxwdTMPkSzlPl60=; b=ChGvTi93wgWD3NOAGpn86k0adHIopNdnX5x/3omMDojedlObWOoR3rWndlWpNWePAJ NwEZWqaeUPzIPYjvHpLb+cN1Cn3PYprYPnMp11tv6PHxuKHNsm2Wq1LyEMlxVs1PVhnr 8PJYsy5eV/AMvvILGmHaFctItMxmxMhH35npJnyUXxcrznelKXLcsATeFVVGVNVu71D4 iU4Y31wkYNq2YAgPOpc8Q6v4YmRqKchOcdghs1+ar1B5ugYbc/X/p1l1UMg1iMpyYek3 u/V3pseaWO+H8yBYJJUV5VPYvDZJw0ZQ9Ksp8OU6LTuLePC7wqAtyXbjV+ll+kBZ3BCE NqWQ== X-Gm-Message-State: APjAAAU6pDiHjnbeQpnik691EeuKd2jrah4lt7COgMSQ220KcmpKEor6 q0M0yNyhhHNqbnYBjymyEmtAS0Kjew== X-Google-Smtp-Source: APXvYqwkXB++jFBOOUuymtAItWPDj/3Lo3eBBRlyHsGVi0CAjgdRUAoV9OR1gy6vavVUsvtrjbgoSQ== X-Received: by 2002:a17:90a:d156:: with SMTP id t22mr3829964pjw.108.1579143819314; Wed, 15 Jan 2020 19:03:39 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id g8sm23095230pfh.43.2020.01.15.19.03.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jan 2020 19:03:38 -0800 (PST) From: Pingfan Liu To: linux-mm@kvack.org Cc: Pingfan Liu , Andrew Morton , David Hildenbrand , Dan Williams , Oscar Salvador , Michal Hocko , kexec@lists.infradead.org, Kazuhito Hagio Subject: [PATCH] mm/sparse: reset section's mem_map when fully deactivated Date: Thu, 16 Jan 2020 11:01:08 +0800 Message-Id: <1579143668-27941-1-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 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: When fully deactivated, it is meaningless to keep the value of a section's mem_map. And its mem_map will be reassigned during re-added. Beside this, it breaks the user space tool "makedumpfile", which makes assumption that a hot-removed section having mem_map as NULL. The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile Signed-off-by: Pingfan Liu To: linux-mm@kvack.org Cc: Andrew Morton Cc: David Hildenbrand Cc: Dan Williams Cc: Oscar Salvador Cc: Michal Hocko Cc: kexec@lists.infradead.org Cc: Kazuhito Hagio Reviewed-by: David Hildenbrand --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 3822ecb..fddac80 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, ms->usage = NULL; } memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); - ms->section_mem_map = sparse_encode_mem_map(NULL, section_nr); + ms->section_mem_map = NULL; } if (section_is_early && memmap)