Received: by 10.192.165.148 with SMTP id m20csp2580517imm; Thu, 26 Apr 2018 13:31:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tJHUzzd9JcdBkDdeboELI+2Nso3Mj28WZHPjRc0FfCu5qz2intHPbvd/TylrVdlLgArut X-Received: by 10.99.145.196 with SMTP id l187mr28638716pge.261.1524774710556; Thu, 26 Apr 2018 13:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524774710; cv=none; d=google.com; s=arc-20160816; b=nd8ebn8kyzxkWSVUYWK0tLNP9VU6/FJdGpIS85Qn5VhJ5iPHCWG6cYmzACp0eaDkht mMdB0fCSfKGA/3GGmtr4FL0utE0U5j7/8JfDcxd/yJflPVWXdpmv8qYb4IQzhsxTf3OE xfcLPNnDTltmH1JQfAFLqKXJ4iIntzWKm+0bIwS3rFQJZCczlbntVJvgxqsNMlud0vVM n/hlLIjleU33IIcLbEDMsN2jcDPxnNz64u1boet/VwWM7ntCBjAoBTNLLP5wsvgiyIXM UWl2OfupwRudyxpIyprulT81Jl0IOIFlK2n21gvddDBgO+BvRdvfadztxoeTNFizRIgy O9qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=l3kKyPXIX1yDp8Ou/+Mv1/mhf1H8j0XubpYxmsxkpUc=; b=rrj1RqE1r/k8K9BlR5+9/sNlo9K4HhhI71WgbMt3i3SDzdSYAuURsMfkrUBDlhDqhA kZvXQCjO3NtTgzhoXLEJ89w/4KuQUWYUfKIRCf1e+eVTGoJZQzdFcbnXBAFGhPEEwDR7 VKLM+ykzWZhJ4k8xwf/jCAeG5caHJQmygpzy9o3rBQRPY56/4YO5tqGfWvTsCmrJ7FHr LtnU9/WyqhTs4rV4OBFoK19M6H3HJKCp1J14VAhaFlAMTu9WGQK77Q3NA0NaqJJAA/Qw oOB8B2DImk8sf2XswhdQqD9QBbsjOj8k6rbDdCnlW0P3Q4NLWh2jFiYTzAyj+5IcV3ry n/Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=QS6WDHwl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7-v6si309042plr.145.2018.04.26.13.31.34; Thu, 26 Apr 2018 13:31:50 -0700 (PDT) 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=@oracle.com header.s=corp-2017-10-26 header.b=QS6WDHwl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755014AbeDZUaP (ORCPT + 99 others); Thu, 26 Apr 2018 16:30:15 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:38300 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753393AbeDZUaO (ORCPT ); Thu, 26 Apr 2018 16:30:14 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3QKPxBr154875; Thu, 26 Apr 2018 20:30:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2017-10-26; bh=l3kKyPXIX1yDp8Ou/+Mv1/mhf1H8j0XubpYxmsxkpUc=; b=QS6WDHwlTJD2D7XPW5dHIYLspVDghSPKYyAklBDnacJf9BGzqXe5yAFCUvghTHAX3T5U Wa/inw9mkDgqoJZFemm0MWYz2/ko6OKUvhbXcyFiXQQ5w5GwR9wsShjkO3p03/KrZ1rS S3b8ai3B/W+FzeckKoiIQC4dXnsadz67dJeHV52Ekmpw9QyexgtBjy+pjnbnioHEmprm GcS93uqMURBjVzeF+PLU7LzlLqHCsVS0EZ1DI4DNGXJdeP8accn4bIFkuyk/7J866aiU YjiDjegY3stHPJFBBRrsGO5cjy4/+Fmg48leUSsfNDFr+83xh0PaBeJclsNx/iAVFNcC oA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2hfw9amw0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 20:30:08 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3QKU7MJ008980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 20:30:08 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3QKU60e018406; Thu, 26 Apr 2018 20:30:06 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Apr 2018 13:30:06 -0700 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, mhocko@suse.com, linux-mm@kvack.org, stable@vger.kernel.org Subject: [PATCH] mm: sections are not offlined during memory hotremove Date: Thu, 26 Apr 2018 16:30:02 -0400 Message-Id: <20180426203002.3151-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8875 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=798 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804260190 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Memory hotplug, and hotremove operate with per-block granularity. If machine has large amount of memory (more than 64G), the size of memory block can span multiple sections. By mistake, during hotremove we set only the first section to offline state. The bug was discovered because kernel selftest started to fail: https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is older than this commit. In this optimization we also added a check for sections to be in a proper state during hotplug operation. Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes") Signed-off-by: Pavel Tatashin Acked-by: Michal Hocko --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index 62eef264a7bd..73dc2fcc0eab 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) unsigned long pfn; for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { - unsigned long section_nr = pfn_to_section_nr(start_pfn); + unsigned long section_nr = pfn_to_section_nr(pfn); struct mem_section *ms; /* -- 2.17.0