Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp242002ybt; Tue, 23 Jun 2020 20:56:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6OaXLtXR/twuJ8R7ASc/1ewgu5xbb30NNUGVG2R2kiAT6GaGYuTiXbBXhSIgx/yZ2pUGl X-Received: by 2002:a17:906:aac1:: with SMTP id kt1mr11347755ejb.408.1592970967412; Tue, 23 Jun 2020 20:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592970967; cv=none; d=google.com; s=arc-20160816; b=R8DE9JnyB+tDY8WR6FPfX/LZtsOR3eBxdZbPZvWgS2VXB/bdhreR+Z0Wb74GofXzNN YT+fKQNMQUARcNWza0he0gbCFlEZ2u4yD2EhVvI6eXuNdEF6wA6xLFqbz+y2pQiLe8nx 8W54Ur2rxq3Sfbdv8EVGsgQRqET4C0MLvSyBL4nX4n26kI+oPUs2/YCWTYfxFQpuWcQC ATeKRxtyC45EL2iZvNWQ3lk1NOTl+w1Xe4zibEBbgNYhqUlPrdocehIxNwKl9hKuu50l to6SNOF0Dwt0ejt4SiwL5bpt9Wa++kejDtrykN8pQQpeCNJ16DQ/lu9qlf5QPfV9/Ive n84Q== 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=GepTlGXwej9PWMeaqwTbVbEVkJTWG3Rdtwgufbgc7OA=; b=Qi1WY9nVwrh3QQpRiRnBoRLzYIuRazlOTSA18idTZk28hHJGHwDMSlG9g1+/Zb4m9Y r9ZRYvo0HYVQCyfH1GnvCnwOPkLbualjqH77iUxVOgIkp3TfmHH/w+4rXX4s6z4dLrs0 i+L6aF4OH6+jzpuEs5Io9uuJITKRVoydbqWGyD1YiET6HnArAeLK4HMAnL0jPQJRQK/o iHaUhwWv3rCAR8JE/X/Gz2q9DIL8BRxWNwHIl5R74KcvqUeEtEI4Tt9IPPlwQ6IomSGZ 7TkdxnOova+nIjI/YHdNUP8r8ke2gVIus6wCs+gtWIFavie6Ex9Mj/G8zOY6y0cfbhce Yw+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h51OoMje; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n23si4121186ejx.656.2020.06.23.20.55.36; Tue, 23 Jun 2020 20:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h51OoMje; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388736AbgFXDwt (ORCPT + 99 others); Tue, 23 Jun 2020 23:52:49 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31454 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388393AbgFXDwt (ORCPT ); Tue, 23 Jun 2020 23:52:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592970768; 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=GepTlGXwej9PWMeaqwTbVbEVkJTWG3Rdtwgufbgc7OA=; b=h51OoMjeB77aomRYGXhdxFzabDRe8jeoJgZvAL8ZBtVB7VaaxW6o1Zq/E7Ca+BG2rhbeIJ eFhsdIE+HR1tsP8s/d5JEXmTUNtb3Wyg+iBXlqZdZBebh++F3IKwKUn8Tnt6pXqeIVFZoS BNkP3Cul4y5HBO2WeYfBuJE7MVaGPC0= 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-214-z8Nk-r7pP8693rTYXcsLQQ-1; Tue, 23 Jun 2020 23:52:44 -0400 X-MC-Unique: z8Nk-r7pP8693rTYXcsLQQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CF19A107ACCA; Wed, 24 Jun 2020 03:52:42 +0000 (UTC) Received: from localhost (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07EFB1A835; Wed, 24 Jun 2020 03:52:38 +0000 (UTC) Date: Wed, 24 Jun 2020 11:52:36 +0800 From: Baoquan He To: Wei Yang Cc: Dan Williams , Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List , David Hildenbrand Subject: Re: [PATCH] mm/spase: never partially remove memmap for early section Message-ID: <20200624035236.GI3346@MiWiFi-R3L-srv> References: <20200623094258.6705-1-richard.weiyang@linux.alibaba.com> <20200624014737.GG3346@MiWiFi-R3L-srv> <20200624034638.GA10687@L-31X9LVDL-1304.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624034638.GA10687@L-31X9LVDL-1304.local> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/24/20 at 11:46am, Wei Yang wrote: > On Wed, Jun 24, 2020 at 09:47:37AM +0800, Baoquan He wrote: > >On 06/23/20 at 05:21pm, Dan Williams wrote: > >> On Tue, Jun 23, 2020 at 2:43 AM Wei Yang > >> wrote: > >> > > >> > For early sections, we assumes its memmap will never be partially > >> > removed. But current behavior breaks this. > >> > >> Where do we assume that? > >> > >> The primary use case for this was mapping pmem that collides with > >> System-RAM in the same 128MB section. That collision will certainly be > >> depopulated on-demand depending on the state of the pmem device. So, > >> I'm not understanding the problem or the benefit of this change. > > > >I was also confused when review this patch, the patch log is a little > >short and simple. From the current code, with SPARSE_VMEMMAP enabled, we > >do build memmap for the whole memory section during boot, even though > >some of them may be partially populated. We just mark the subsection map > >for present pages. > > > >Later, if pmem device is mapped into the partially boot memory section, > >we just fill the relevant subsection map, do return directly, w/o building > >the memmap for it, in section_activate(). Because the memmap for the > >unpresent RAM part have been there. I guess this is what Wei is trying to > >do to keep the behaviour be consistent for pmem device adding, or > >pmem device removing and later adding again. > > > >Please correct me if I am wrong. > > You are right here. > > > > >To me, fixing it looks good. But a clear doc or code comment is > >necessary so that people can understand the code with less time. > >Leaving it as is doesn't cause harm. I personally tend to choose > >the former. > > > > The former is to add a clear doc? Sorry for the confusion. The former means the fix in your patch. Maybe a improved log and some code comment adding can make it more perfect. > > > paging_init() > > ->sparse_init() > > ->sparse_init_nid() > > { > > ... > > for_each_present_section_nr(pnum_begin, pnum) { > > ... > > map = __populate_section_memmap(pfn, PAGES_PER_SECTION, > > nid, NULL); > > ... > > } > > } > > ... > > ->zone_sizes_init() > > ->free_area_init() > > { > > for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) { > > subsection_map_init(start_pfn, end_pfn - start_pfn); > > } > > { > > > > __add_pages() > > ->sparse_add_section() > > ->section_activate() > > { > > ... > > fill_subsection_map(); > > if (nr_pages < PAGES_PER_SECTION && early_section(ms)) <----------********* > > return pfn_to_page(pfn); > > ... > > } > >> > > -- > Wei Yang > Help you, Help me >