Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3457655ybv; Sun, 9 Feb 2020 23:55:49 -0800 (PST) X-Google-Smtp-Source: APXvYqy4zGy1Q5lqY6N6Gp2/I/gZqHykq48OXUTl8PMJcgk2xUoM0/NoZaO2u3kN7rYWDMKStLLi X-Received: by 2002:a05:6830:200d:: with SMTP id e13mr170402otp.364.1581321349640; Sun, 09 Feb 2020 23:55:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581321349; cv=none; d=google.com; s=arc-20160816; b=gtgzMbjD11q5F7ixhdcy7CCmgOP4tzCMOeIcmBdLZ/zaw3t8Lv932ATfVW+8yGsIsz wE/47AJXh3PQ/JCU4B4iuWbqq+l+PbFQv6NNRVZmD05ZXshWOmm/j2PkDeQma1GrxtDm VRVRXpjx4T9QzpO+3XZ/hflCIprr1joZeSddz3bi2J0xD0HIQNdDe3CuBFj5R7ULHXTY ZBvAir96GB5i+DVRTZjN8vs0lc6yDFQpZbDLeAAfImUagIHVkHhDDg6GkFOF2cjIkuxs VMHDbfgbxRsSmF1j3tFwwe60A+QDgK+BgLlelcxELtp3SKLUrEX58Q59bfTOxIiQQrHG d3cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XgLHa51B4K0w5LvvHzrXajltEAxAjyKabDg5eUISb44=; b=lrKFpb4nOLHo4FC6op1gB/mkvCXL7iVezOLhZP3bn8PM2qmf26t8RWeS8iHPiL1Qen FicIEzk9GqRJybRO5WR5zUvGHgyGq9mQEu1yDNDKMNLukw9hdgazbeqSs6i+x0B3QK29 1XOTh/SxaHU6wzshJMzAhBHpd2ZG73sZ2eIadl3pXcXLlVyIgEEfWd4lTnGAVWFdGCLl 2nonyduhfkJz8AUXhkUULDuZeHZrlnzldE5lWCoFA9saRwcJEH1/G9VHObCP6TIPQCYH GI++FqZEeaLg1EwneV2Ns7LfMA0mhW6CkwwfhO+nexInauroUhN4l03DLk0H6EFI3cFb lSWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TSQ1toVe; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si4242378otq.41.2020.02.09.23.55.38; Sun, 09 Feb 2020 23:55:49 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=TSQ1toVe; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727056AbgBJHyU (ORCPT + 99 others); Mon, 10 Feb 2020 02:54:20 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45736 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725468AbgBJHyU (ORCPT ); Mon, 10 Feb 2020 02:54:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581321258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XgLHa51B4K0w5LvvHzrXajltEAxAjyKabDg5eUISb44=; b=TSQ1toVeXYO7mZ6+xlC42LK3XY7GzA1SOaLg5bEqW2lUxaSldR1zroc4alZ/X47VeCE7bw fYuxgoqbPj7x0DcPKScDa2Wfw4OfpMlRT4FhIvrFq7LjRmex8rXryBCNxKksy0tDms2trb F1deQ09H6ORxAVvYX/vZhae1TQyy764= 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-54-GVX0NUuzPkabOEQeyZpvpg-1; Mon, 10 Feb 2020 02:54:15 -0500 X-MC-Unique: GVX0NUuzPkabOEQeyZpvpg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCF671005514; Mon, 10 Feb 2020 07:54:13 +0000 (UTC) Received: from localhost (ovpn-12-27.pek2.redhat.com [10.72.12.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F39E90061; Mon, 10 Feb 2020 07:54:09 +0000 (UTC) Date: Mon, 10 Feb 2020 15:54:06 +0800 From: Baoquan He To: Wei Yang Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, dan.j.williams@intel.com, david@redhat.com Subject: Re: [PATCH 7/7] mm/hotplug: fix hot remove failure in SPARSEMEM|!VMEMMAP case Message-ID: <20200210075406.GE8965@MiWiFi-R3L-srv> References: <20200209104826.3385-1-bhe@redhat.com> <20200209104826.3385-8-bhe@redhat.com> <20200209235202.GC8705@richard> <20200210034105.GA8965@MiWiFi-R3L-srv> <20200210060804.GF7326@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210060804.GF7326@richard> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/10/20 at 02:08pm, Wei Yang wrote: > On Mon, Feb 10, 2020 at 11:41:05AM +0800, Baoquan He wrote: > >On 02/10/20 at 07:52am, Wei Yang wrote: > >> >--- > >> > mm/sparse.c | 4 +++- > >> > 1 file changed, 3 insertions(+), 1 deletion(-) > >> > > >> >diff --git a/mm/sparse.c b/mm/sparse.c > >> >index 623755e88255..345d065ef6ce 100644 > >> >--- a/mm/sparse.c > >> >+++ b/mm/sparse.c > >> >@@ -854,13 +854,15 @@ 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 = (unsigned long)NULL; > >> > } > >> > > >> > if (section_is_early && memmap) > >> > free_map_bootmem(memmap); > >> > else > >> > depopulate_section_memmap(pfn, nr_pages, altmap); > >> > >> The crash happens in depopulate_section_memmap() when trying to get memmap by > >> pfn_to_page(). Can we pass memmap directly? > > > >Yes, that's also a good idea. While it needs to add a parameter for > >depopulate_section_memmap(), the parameter is useless for VMEMMAP > >though, I personally prefer the current fix which is a little simpler. > > > > Not a new parameter, but replace pfn with memmap. > > Not sure why the parameter is useless for VMEMMAP? memmap will be assigned to > start and finally pass to vmemmap_free(). In section_deactivate(), per the code comments from Dan, we can know that: /* * section which only contains bootmem will be handled by * free_map_bootmem(), including a complete section, or partial * section which only has memory starting from the begining. */ if (section_is_early && memmap) free_map_bootmem(memmap); else /* * section which contains region mixing bootmem with hot added * sub-section region, only sub-section region, complete * section. And in the mxied case, if hot remove the hot added * sub-section aligned part, no memmap is got in the current * code. So we still need pfn to calculate it for vmemmap case. * To me, whenever we need, it looks better that we always use * pfn to get its own memmap. */ depopulate_section_memmap(pfn, nr_pages, altmap); This is why I would like to keep the current logic as is,only one line of code adjusting can fix the issue. Please let me know if I miss anything. > > >Anyway, both is fine to me, I can update if you think passing memmap is > >better. > > > >> > >> >+ > >> >+ if(!rc) > >> >+ ms->section_mem_map = (unsigned long)NULL; > >> > } > >> > > >> > static struct page * __meminit section_activate(int nid, unsigned long pfn, > >> >-- > >> >2.17.2 > >> > >> -- > >> Wei Yang > >> Help you, Help me > >> > > -- > Wei Yang > Help you, Help me >