Received: by 10.192.165.148 with SMTP id m20csp2312112imm; Thu, 26 Apr 2018 09:00:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx49PEaR8kH86l7zESJMwoeyQ4+IS4PAiFPTj/2yzoUd+OwiRLwHPcpU6+JhCaZjCYB5j203r X-Received: by 10.99.63.6 with SMTP id m6mr23849874pga.340.1524758421999; Thu, 26 Apr 2018 09:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524758421; cv=none; d=google.com; s=arc-20160816; b=x3kHFGBlRdGzb+phR/sOVZ2UnhYrgeRu2I8oayYfqBzg6e0AnzpDT7+MbKOD2ytvrb NBbycYKuvMCdZ/ess9Ab8nHr0tXvKZwXvWksse8kteRY3R9/XehsXJ8Ngv6FeyHbnUHR Pn+8umHNquN0H+tJqFErawFj0Q2rUqZEimpsPxEMosxK7gnE1EfPm/Q47gnoyYgi9fCK CYq5DFBBg/NPgE1IN4GiFC/BfyrNXzLr7Pf7ent1+VlpApG5L5x+vxtEvGV00Yl61X0i jFq6R2H47D6o2Mlb++KUoF9ozj4wXVnY1HkpuAV8vci7lludKU6nOyCGdqXJHeJ9arsB 017Q== 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=gPfEf/IEnG5EoB+xpQ4iJLSZbVEVFod43SkfxINhjO8=; b=OlpiKEBL8v7hFg15o+j89JnV5Vu5W+xRMsHWZNFMj6+NvbMbuQHOyDv474grKlJ8qV Y465CTEdwt+ciwoc8gnRt52TYKoh6wXmkEnso6x9/lJYEtph0xATWcpQXQMwaaq59noB w8mL/1nVsnC3GhK+Cz2CvNhVUPeBtpMHFayGUMuDQ5paWHEDkF8sWEyUxkSExJgt7Qlo wTZxCcaxV57bwT8G8ENNVuysE5L8Yay2qyDW/WHGz2H6DWbrpp7YxjUxaH+WuLVJmb/M dgKV5nkWLLB/9M5SenhZzsRY4HvkJ9CoadSGfnKVuQYLjD6lbkXVQFeQ+r5FfBYq1R1s SqmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=cjxdy4JI; 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 j84si14447661pfk.203.2018.04.26.09.00.06; Thu, 26 Apr 2018 09:00:21 -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=cjxdy4JI; 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 S1756770AbeDZP6s (ORCPT + 99 others); Thu, 26 Apr 2018 11:58:48 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:39022 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756519AbeDZP6q (ORCPT ); Thu, 26 Apr 2018 11:58:46 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3QFuVku113565; Thu, 26 Apr 2018 15:58:41 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=gPfEf/IEnG5EoB+xpQ4iJLSZbVEVFod43SkfxINhjO8=; b=cjxdy4JIhBjFEoBayEw3K/Dq3TfjB9r15YnWKNI9WY5TEhTpRjjs3OIfaSDeRum+PyVr 7pmXrDyJaML6Q3rVO2Cyd+nixr8KlhllPN7QamWkYBsECajLrCn6Tq/VG23KleEY975u 4aR+vEsuoYAXq4qM5vaWQUiUCc+lzQ1fT/51bSgnAaGAbaOQlFHv1l1JXo7L61qdVJNe 9yQ2YzKRlPOee9AaDdrt9qVQ3VO35QqJM95FGs1pr9lax4T5FeYyEPM64D7CbYnFvuD+ OHCRn0DnRNx2jN5cUO/mbGTybU3Yyin/1twaZMxaYBomL5/kqnTd/4rRszGeUOayne8F WQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2hfwy9uxbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 15:58:40 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3QFwdQ0020799 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 15:58:39 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3QFwc6S013653; Thu, 26 Apr 2018 15:58:38 GMT Received: from xakep.us.oracle.com (/10.39.218.130) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Apr 2018 08:58:38 -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 Subject: [PATCH] mm: sections are not offlined during memory hotremove Date: Thu, 26 Apr 2018 11:58:34 -0400 Message-Id: <20180426155834.16845-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=782 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804260151 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 --- 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; /* -- 1.8.3.1