Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp184675rdg; Thu, 12 Oct 2023 02:37:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWuN4SqL3w+F/fznrub2dnxO4h8HTH8sMsDup56wUFf0E6xH1N82VGAeg79zv927GvQsXo X-Received: by 2002:a05:6a20:431a:b0:159:f884:4d6e with SMTP id h26-20020a056a20431a00b00159f8844d6emr26276158pzk.40.1697103426169; Thu, 12 Oct 2023 02:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697103426; cv=none; d=google.com; s=arc-20160816; b=iNh4sCYqk25bu690xyHfJ6oe+3d4LegyV/4/zpskrnXgTkC8947u1j0+Es7rjALlIs L9pcTcyF5BQ5nerc0m50bUybYM7rE8askl1MxOnRb3GDW8mPHWh4jB8AqpdHTryRjU+Q TtLHQCDAEvza7sqhNtiZRaP0PINmUcAY0DfsaWF3Dzc/YgNwqulOQUthACk0fN+rTVdL FHc8lu/5PR6I99jVrOGbqYzFoZgUFAolcgdxz9jcdk0W2BtVrAMx9SS5he62v1aEAYV0 BTBxVLDaixCEbcMdsFbSB467zCO4C84FSLoBS2KIEzMg+P1ZjTz4mqrnCv5wi/Q2k9Tr 1Cgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=ZJ7Hvxze07BnW+iLsUmdQvphJeSNuEhC6cbejDQqx+I=; fh=WzmU0R+Jl7RzUb7lYiYf1G4vfjpBuXWbidBx19MTwwE=; b=GthelPuviF1Kyke1OPQy2raS1YKYZNgmelouVNY4pztVbdz26SrrsyGlnv0O4KTAaZ gWabJhoCk+HQ8LgoVa/0NIY8GzJcTNGxTcvb4ADE++KhMaLCg1bxY6NZ5zmEpSmJoswX hbnkzZyz8Ty7+twZSuDywthrcs2KW7Dqviqd4QHpDHSw3mdKeF61jlE3jqaM70I64Wwj T6DpL7+g6qwEu0vZ5+xQOC14M+f790PNZjyrG69RdW4s5PpLdxcIEOjN/v3DOsPQw/mP F4phVznCS6RsZLsoUoY7D/pY2Wd/AVhi3y+f2FHq0raJpLG2sbryUFssGfNIgcPFFO0A UOwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=M2oWhf1W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id lp1-20020a17090b4a8100b002791a73ab07si2056688pjb.54.2023.10.12.02.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=M2oWhf1W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CEEF580ED999; Thu, 12 Oct 2023 02:37:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235513AbjJLJgz (ORCPT + 99 others); Thu, 12 Oct 2023 05:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjJLJgx (ORCPT ); Thu, 12 Oct 2023 05:36:53 -0400 Received: from out-207.mta1.migadu.com (out-207.mta1.migadu.com [IPv6:2001:41d0:203:375::cf]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE42A91 for ; Thu, 12 Oct 2023 02:36:51 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697103409; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZJ7Hvxze07BnW+iLsUmdQvphJeSNuEhC6cbejDQqx+I=; b=M2oWhf1WUsxDITd54dPtMLI0p3RWx+acBeFB5GSpNUhWhAGw1KPbjcG2VQrdbLyqgBC0gH KJS7kna6ZLAum46fmEE7Xp+j/LMMue+3QAAseUsK71VQEKViOAeqaiHh/4w8KAoWAa5wtc dKqc2eV2+sFyCv1qemE4x1zsTydVCuE= Date: Thu, 12 Oct 2023 17:36:40 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v4 2/2] mm: Init page count in reserve_bootmem_region when MEMINIT_EARLY Content-Language: en-US To: Mike Rapoport Cc: David Hildenbrand , akpm@linux-foundation.org, mike.kravetz@oracle.com, muchun.song@linux.dev, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <15233624-f32e-172e-b2f6-7ca7bffbc96d@linux.dev> <20231001185934.GX3303@kernel.org> <90342474-432a-9fe3-2f11-915a04f0053f@linux.dev> <20231002084708.GZ3303@kernel.org> <20231002111051.GA3303@kernel.org> <3057dab3-19f2-99ca-f125-e91a094975ed@redhat.com> <8c9ee3bd-6d71-4111-8f4e-91bc52b42ed4@linux.dev> <20231005050619.GB3303@kernel.org> <6545ac4c-1205-6c09-49ea-e00c24d1a2ff@linux.dev> <20231012091906.GQ3303@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <20231012091906.GQ3303@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 02:37:04 -0700 (PDT) On 2023/10/12 17:19, Mike Rapoport wrote: > On Thu, Oct 05, 2023 at 10:04:28PM +0800, Yajun Deng wrote: >>>>>>>> That 'if' breaks the invariant that __free_pages_core is >>>>>>>> always called for pages with initialized page count. Adding >>>>>>>> it may lead to subtle bugs and random memory corruption so we >>>>>>>> don't want to add it at the first place. >>>>>>> As long as we have to special-case memory hotplug, we know that >>>>>>> we are always coming via generic_online_page() in that case. We >>>>>>> could either move some logic over there, or let >>>>>>> __free_pages_core() know what it should do. >>>>>> Looks like the patch rather special cases MEMINIT_EARLY, although >>>>>> I didn't check throughfully other code paths. Anyway, relying on >>>>>> page_count() to be correct in different ways for different >>>>>> callers of __free_pages_core() does not sound right to me. >>>>> Absolutely agreed. >>>>> >>>> I already sent v5  a few days ago. Comments, please... >>> Does it address all the feedback from this thread? >> Except hotplug. > Please reread carefully the last comments from me and from David above. > I replied in another thread about that 'if' statement. David just replied to me, let's discuss in another thread.