Received: by 10.192.165.148 with SMTP id m20csp810928imm; Fri, 27 Apr 2018 07:54:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpBI5bALP53pmexWyRz9Hwd48WfzLChcPBC5PE8bNBPAaqh02wZKa/lITZr/IsTxUtNM1w+ X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr2609405plb.55.1524840867655; Fri, 27 Apr 2018 07:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524840867; cv=none; d=google.com; s=arc-20160816; b=hgrmcsLm4BKyHXWT6aL9imZy7ZDtd8pe/tHHxe+N7gbQtGa6sWQyPIfH5zUuPJ6el+ RR7pPLgXeG8bQHTLIuHatIYTfRrHHmuprHmwoB4kJcxyiXXgtXg8vzoco380sCMOEk/3 I8O+OuB76cmMSHo8pjQETfOqNnzBlVW6K9dgXvJxSZYUYITsqQzV+r93IkKAUor/qnuJ cHfGuxb99hoqoOIwcgKvWRs4jqCRcUSCZIIf0Gywsa31SU5i3QPyn9pKx/Omr8SsbEsi SsJSl51wr443R+rfWKiOHnTM01io9qZBLmCYTKCMJrVqf2QM63ys5BnEOAxdcdSzQ5Zl cyaQ== 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=iGX4saMpwAgz535YfScOI5gPFPCgBpxMCr6JsFcHm7s=; b=b5HukS9IiygbPBXHx2Sx4EvpS9OKYBR7DzubP4G3fPQaC6xdi/1UlgYToPo6XgFcLP R47sD6N0KhPC4ZD6yBygqvYKhtKeavMRZxmKOqASjRNYaYl7w61lDH8OM1D5HX1Sdijj dQ5arwTmnVYSa/nzLSAD+LQ/VuRKitnIJJgBWNsjm3taUADSgiIyA1Zsv8i0l8zoZohn f5Ltjhlm/Zc9kn/rn9q2usdT6xNP7CBzmGhjP2zldN/BnwPVEWo4K4oPWmMqUS5VxmUe yJfqvvP0hvQs6Ypi1aKuV7QLHKwMnN54inPIZmuhC26/MiZRS77N5X7Wq6xDvhX08Iv0 tNqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=iqr1mnwy; 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 s11-v6si1356756pgn.403.2018.04.27.07.54.13; Fri, 27 Apr 2018 07:54:27 -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=iqr1mnwy; 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 S934432AbeD0OxK (ORCPT + 99 others); Fri, 27 Apr 2018 10:53:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:53404 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934199AbeD0OxI (ORCPT ); Fri, 27 Apr 2018 10:53:08 -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 w3REp7Wu040848; Fri, 27 Apr 2018 14:53:02 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=iGX4saMpwAgz535YfScOI5gPFPCgBpxMCr6JsFcHm7s=; b=iqr1mnwyvKHxf98TuB0UYm3jMA5MhQjrbJu9r7GYNamxrx4Fotiwn7XQiB0acO48wnHn d5IVrYiZULZ05BwpQRxRM09XNh+w+sTj4VGCjTb5JKgD1SE3Gm1fCL21DaQTzkj6TGVa DQtVD7tGLziadAzAVqyHwKAlMpNh7TFMH3mbPbe7jL6G8lSErMlgcqum/VRs3ZQKLhFX gLkGBEY/ELmJEYGASIZy9KDPAQR6MFpZKJLfVP/mYc17fvvNnDGnhjJZmiRaX5CIO/zf uTFT0GJyN4Au/pPt/ij1zdDipFNepZW9eit05jl6wJIO2fNuib4bJgsMB8PDIZk/9EkU uw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2hfwy9ywep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Apr 2018 14:53:02 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3REr2Bx000390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Apr 2018 14:53:02 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3REr1b1007220; Fri, 27 Apr 2018 14:53:02 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Apr 2018 07:53:01 -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 v2] mm: sections are not offlined during memory hotremove Date: Fri, 27 Apr 2018 10:52:57 -0400 Message-Id: <20180427145257.15222-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=815 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804270143 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 Cc: stable@vger.kernel.org --- 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