From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E612C433DF for ; Tue, 23 Jun 2020 09:30:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1DDA620706 for ; Tue, 23 Jun 2020 09:30:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DDA620706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8709C6B0006; Tue, 23 Jun 2020 05:30:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 820D16B0007; Tue, 23 Jun 2020 05:30:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70FC06B0008; Tue, 23 Jun 2020 05:30:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 557E06B0006 for ; Tue, 23 Jun 2020 05:30:38 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 15B98180AD837 for ; Tue, 23 Jun 2020 09:30:38 +0000 (UTC) X-FDA: 76959956556.16.bun20_1c1490726e3a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id E7435100E663A for ; Tue, 23 Jun 2020 09:30:37 +0000 (UTC) X-HE-Tag: bun20_1c1490726e3a X-Filterd-Recvd-Size: 3767 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 23 Jun 2020 09:30:35 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0U0V8lOr_1592904618; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U0V8lOr_1592904618) by smtp.aliyun-inc.com(127.0.0.1); Tue, 23 Jun 2020 17:30:18 +0800 Date: Tue, 23 Jun 2020 17:30:18 +0800 From: Wei Yang To: David Hildenbrand Cc: Wei Yang , Wei Yang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , stable@vger.kernel.org, Andrew Morton , Johannes Weiner , Minchan Kim , Huang Ying , Mel Gorman , Dan Williams Subject: Re: [PATCH v2 1/3] mm/shuffle: don't move pages between zones and don't read garbage memmaps Message-ID: <20200623093018.GA6069@L-31X9LVDL-1304.local> Reply-To: Wei Yang References: <20200619125923.22602-2-david@redhat.com> <20200622082635.GA93552@L-31X9LVDL-1304.local> <2185539f-b210-5d3f-5da2-a497b354eebb@redhat.com> <20200622092221.GA96699@L-31X9LVDL-1304.local> <34f36733-805e-cc61-38da-2ee578ae096c@redhat.com> <20200622131003.GA98415@L-31X9LVDL-1304.local> <0f4edc1f-1ce2-95b4-5866-5c4888db7c65@redhat.com> <20200622215520.wa6gjr2hplurwy57@master> <4b7ee49c-9bee-a905-3497-e3addd8896b8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: E7435100E663A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000398, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 23, 2020 at 09:55:43AM +0200, David Hildenbrand wrote: >On 23.06.20 09:39, David Hildenbrand wrote: >>> Hmm.. I thought this is the behavior for early section, while it looks current >>> code doesn't work like this: >>> >>> if (section_is_early && memmap) >>> free_map_bootmem(memmap); >>> else >>> depopulate_section_memmap(pfn, nr_pages, altmap); >>> >>> section_is_early is always "true" for early section, while memmap is not-NULL >>> only when sub-section map is empty. >>> >>> If my understanding is correct, when we remove a sub-section in early section, >>> the code would call depopulate_section_memmap(), which in turn free related >>> memmap. By removing the memmap, the return value from pfn_to_online_page() is >>> not a valid one. >> >> I think you're right, and pfn_valid() would also return true, as it is >> an early section. This looks broken. >> >>> >>> Maybe we want to write the code like this: >>> >>> if (section_is_early) >>> if (memmap) >>> free_map_bootmem(memmap); >>> else >>> depopulate_section_memmap(pfn, nr_pages, altmap); >>> >> >> I guess that should be the way to go >> >> @Dan, I think what Wei proposes here is correct, right? Or how does it >> work in the VMEMMAP case with early sections? >> > >Especially, if you would re-hot-add, section_activate() would assume >there is a memmap, it must not be removed. > You are right here. I didn't notice it. >@Wei, can you send a patch? > Sure, let me prepare for it. >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me