Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp238488ybt; Tue, 23 Jun 2020 20:48:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuDXbCyT8HOrNEK8lVD2kVeZLzmcC4HPJvFH4MTEf48YN/akW1JiMxbfp2/tP1ROTAz+4d X-Received: by 2002:aa7:d054:: with SMTP id n20mr24572443edo.344.1592970505423; Tue, 23 Jun 2020 20:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592970505; cv=none; d=google.com; s=arc-20160816; b=XPkPwLhegj/Q0r/bTj+2WTJAxVyPU/Nv3sQrn7WiAEG+h+Twq9nFUDt3LEknUuhtLE l/xiLNYUHKn8Znw8nfdeRwlf2WjaAf8xp6CZTW6x0MDYYi69koUykaxxCOjPYPHj5Qd3 pqN5vuezsWZS3pRHkkfBbD4dJIU7LZ+2WiwWDkiQcBvMZ8tiDZqyYkgYPUWvJSg4Tf7L br+/JZxdmZbJNPl65EjNKVdJAE0+8wPdmyuMu798lfgz5reUkyT8Q8KtevJ5+H0pMRTt aaN1gRu+akcmy/dV8zTXMziGiSRkn25OyhS9E7lhbHQs66ib/HpxrqwO/2aP0d16xOwP DinQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=lFqWsV5yZUBpTdZOTisDRMX7NxZGlPAVOMOxie97f8Q=; b=NeX0hrrfDjOUn2E73IWNKY0FWSTiYlPNjI5Ge7AYvRkcsfTGSzn/zQeArskTjrRlge 0nnKJafZKjWD97szLecXk6Viki9PQJXgLFBnMKsPG8w2j1A4UNc9PXtwzSDlHTymEeyK sSCvfZRqTj+DYpyNncEncLMSAlz+sSZtL7lBGhUWFWjzXBh2Zqx3NQKxVbzAhzBZlhGH oFT64Y4gHyec+YwF9RRST57zyj/SPpWp1Ehd4KS6JHh7O5D2Bc0TzGq4UMRckddNg3CV U8sXyJtDm6KSVwGs5SarDo482P6vmZAC5n2zrAQidfB4l+16EoulQt0uQrsvvE3yno8K TKdA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt18si11729886ejb.445.2020.06.23.20.48.02; Tue, 23 Jun 2020 20:48:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388708AbgFXDqw (ORCPT + 99 others); Tue, 23 Jun 2020 23:46:52 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:38933 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388572AbgFXDqv (ORCPT ); Tue, 23 Jun 2020 23:46:51 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0U0Yx7JE_1592970398; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U0Yx7JE_1592970398) by smtp.aliyun-inc.com(127.0.0.1); Wed, 24 Jun 2020 11:46:39 +0800 Date: Wed, 24 Jun 2020 11:46:38 +0800 From: Wei Yang To: Baoquan He Cc: Dan Williams , Wei Yang , 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: <20200624034638.GA10687@L-31X9LVDL-1304.local> Reply-To: Wei Yang References: <20200623094258.6705-1-richard.weiyang@linux.alibaba.com> <20200624014737.GG3346@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624014737.GG3346@MiWiFi-R3L-srv> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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