From patchwork Thu Mar 12 12:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11434135 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 D82A292A for ; Thu, 12 Mar 2020 12:44:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9775E206E7 for ; Thu, 12 Mar 2020 12:44:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HRFEHuB8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9775E206E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E0CE6B000A; Thu, 12 Mar 2020 08:44:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 590F56B000C; Thu, 12 Mar 2020 08:44:29 -0400 (EDT) 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 4A6E66B000D; Thu, 12 Mar 2020 08:44:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 306AB6B000A for ; Thu, 12 Mar 2020 08:44:29 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0DC7F246B for ; Thu, 12 Mar 2020 12:44:29 +0000 (UTC) X-FDA: 76586678658.02.shoes28_a02538681b20 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30003:30012:30054:30070,0,RBL:205.139.110.120:@redhat.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: shoes28_a02538681b20 X-Filterd-Recvd-Size: 4560 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Mar 2020 12:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584017068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=U43XaPUC3PwlgayDYxZ3AihkbX2l033vy/KfO0DfgaA=; b=HRFEHuB8mBxl2wlWGVBkEQMU8RvZWbfirLmAcMgfBu5PDtPlGeTuDrJnoEnBJIfISimQDd AQCJbOt7VMhxCUG5FpeBrVYtoaejkq5B18V1nojeHcj8eFAtcaCc6HMVtCSL3sdaU1jElg PTxLJmlra48ZyDxmIzS0yYfy4dUya78= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-jSsTkPoOMc-4uT-JjrVZTg-1; Thu, 12 Mar 2020 08:44:24 -0400 X-MC-Unique: jSsTkPoOMc-4uT-JjrVZTg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2A4F107B7E4; Thu, 12 Mar 2020 12:44:22 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-43.pek2.redhat.com [10.72.12.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0ACBD8FBFE; Thu, 12 Mar 2020 12:44:15 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com, david@redhat.com, richard.weiyang@gmail.com, dan.j.williams@intel.com, bhe@redhat.com Subject: [PATCH v4 0/5] mm/hotplug: Only use subsection map for VMEMMAP Date: Thu, 12 Mar 2020 20:44:09 +0800 Message-Id: <20200312124414.439-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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: Memory sub-section hotplug was added to fix the issue that nvdimm could be mapped at non-section aligned starting address. A subsection map is added into struct mem_section_usage to implement it. However, config ZONE_DEVICE depends on SPARSEMEM_VMEMMAP. It means subsection map only makes sense when SPARSEMEM_VMEMMAP enabled. For the classic sparse, subsection map is meaningless and confusing. About the classic sparse which doesn't support subsection hotplug, Dan said it's more because the effort and maintenance burden outweighs the benefit. Besides, the current 64 bit ARCHes all enable SPARSEMEM_VMEMMAP_ENABLE by default. This patchset is rebased on the old patch 1 of v3 and an apended fix which doesn't initialize the local variable 'empty'. The old patch 7 in v3 will be taken out to post alone, since it's a clean up patch, not related to this subsection map handling. Changelog v3->v4: No big change, mainly address concerns from David. v2->v3: David spotted a code bug in the old patch 1, the old local variable subsection_map is invalid once ms->usage is resetting. Add a local variable 'empty' to cache if subsection_map is empty or not. Remove the kernel-doc comments for the newly added functions fill_subsection_map() and clear_subsection_map(). Michal and David suggested this. Add a new static function is_subsection_map_empty() to check if the handled section map is empty, but not return the value from clear_subsection_map(). David suggested this. Add document about only VMEMMAP supporting sub-section hotplug, and check_pfn_span() gating the alignment and size. Michal help rephrase the words. v1->v2: Move the hot remove fixing patch to the front so that people can back port it to easier. Suggested by David. Split the old patch which invalidate the sub-section map in !VMEMMAP case into two patches, patch 4/7, and patch 6/7. This makes patch reviewing easier. Suggested by David. Take Wei Yang's fixing patch out to post alone, since it has been reviewed and acked by people. Suggested by Andrew. Fix a code comment mistake in the current patch 2/7. Found out by Wei Yang during reviewing. Baoquan He (5): mm/sparse.c: introduce new function fill_subsection_map() mm/sparse.c: introduce a new function clear_subsection_map() mm/sparse.c: only use subsection map in VMEMMAP case mm/sparse.c: add note about only VMEMMAP supporting sub-section support mm/sparse.c: move subsection_map related functions together include/linux/mmzone.h | 2 + mm/sparse.c | 136 ++++++++++++++++++++++++++++------------- 2 files changed, 95 insertions(+), 43 deletions(-)