Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1750181rdh; Tue, 26 Sep 2023 02:19:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZwyKjia/hZZpk7nOVJUZl4R3OYXBeIDPe2BZlHrb26UFBSRZufk0kOeoppRCU7QSxYxj0 X-Received: by 2002:a05:6a21:3d87:b0:15d:ae4a:9a72 with SMTP id bj7-20020a056a213d8700b0015dae4a9a72mr6663588pzc.61.1695719983268; Tue, 26 Sep 2023 02:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695719983; cv=none; d=google.com; s=arc-20160816; b=GhOwNIvArQNAegA8Eeri32On2SDlQiXKKgyKzreKSWpwZVBO1oVDyRQcKdhXv6o+Sg otUfwXKS6WjTUbRSJPihxPl8/uVi3/6GFPCFLFAc93svRTxmipI1WeWE4y/CjUFJtxM0 upYhf/p+r7nzj0g/hgHmEUdp0YdRqZpy/TFT8W08vAVio7QRSlRbh+cFuVMuJklqglO8 1tjABIk+eXpKVPVYaADX2Ni99pcBHmzp1bzqZxMaG+V0O5MCh51arLkW+Oo7ZwJk4Mpg e4sxbqdxMlkSbShyuO5VSt4uH633utFg2UCOKG4PbGD1ikc4JevG5EHvTLRKiVkILS+Q 09AQ== 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=z4sxViBIUK9Xji+V4y3qHtoLu+O9zEJAdt1f5evurSk=; fh=VK97LY9atnhU2r2lXFanrLuplXJeVM3KBR5d3uWzMXE=; b=hHXCP+AFV0/M8w5HN78sC4EW/DWiYZLczos8CppmRF/fxxweJ4nT9+Ho9VOjhet0OS rsDGT/mzISt91PNDsxU+C58fpzUsK0UTWiQL5+4t9n0otgoZW4HK1/r/Syzft/OeMe5E SAtPqpZelF27LEQY2EVp/oy73lY2GlrNCKatGaWRihRJdhVyCSk9TtRO+eJ+x4J1BhHB IQLPiGKnx1GeB1tnmFExxrMbws8zp+MehCBMpIT781lFc8lDPuEjO3vao+y9QJnRLrQW pxnY93zOyMjaePoFIFg3fh9PPG9/yLk+h8ashPCdGnXKwAEGQ9oyGzaoJCFtdOPJDfZ1 djbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=O7QO+SS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q9-20020a170902a3c900b001c604a96b42si6212535plb.164.2023.09.26.02.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=O7QO+SS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 48EFC81CDE1A; Tue, 26 Sep 2023 00:57:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbjIZH5f (ORCPT + 99 others); Tue, 26 Sep 2023 03:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjIZH5d (ORCPT ); Tue, 26 Sep 2023 03:57:33 -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 6DF5592 for ; Tue, 26 Sep 2023 00:57:25 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1695715043; 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=z4sxViBIUK9Xji+V4y3qHtoLu+O9zEJAdt1f5evurSk=; b=O7QO+SS6VfuE5VU28oGjgYJJrfpLy4LXAXb0BuMjnB77fMIS4Kuaq73n0R3ast6O70EIYW sp7jEOG44o4xGZe3I618U9aKhErG1lySKFbFiOa8fktlxogj2ZIL0QEVvCOV1/hgHweOgq VFlolSYazVCdSFuv5DNJz/ljXpDBqw8= Date: Tue, 26 Sep 2023 15:57:10 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v3 1/2] mm: pass page count and reserved to __init_single_page Content-Language: en-US To: David Hildenbrand , akpm@linux-foundation.org, rppt@kernel.org Cc: mike.kravetz@oracle.com, muchun.song@linux.dev, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230926023341.991124-1-yajun.deng@linux.dev> <20230926023341.991124-2-yajun.deng@linux.dev> <9777812e-c8c8-2105-cd2c-443438786172@redhat.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <9777812e-c8c8-2105-cd2c-443438786172@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 26 Sep 2023 00:57:35 -0700 (PDT) On 2023/9/26 15:44, David Hildenbrand wrote: > On 26.09.23 04:33, Yajun Deng wrote: >> When we init a single page, we need to mark this page reserved if it >> does. > > I failed to parse the last part of this sentence. > >> And some pages may not need to set page count, such as compound >> pages. > > Usually, the refcount of all tail pages *must* be zero. Otherwise, > get_page_unless_zero() would work on tail pages. > > Can you elaborate why it should be okay here? > > It means the following code in memmap_init_compound(). -               __init_zone_device_page(page, pfn, zone_idx, nid, pgmap); +               __init_zone_device_page(page, pfn, zone_idx, nid, pgmap, 0);                 prep_compound_tail(head, pfn - head_pfn);                 set_page_count(page, 0); As we can see, it will reset the page count by 'set_page_count(page, 0)'. Therefore, we don't need to set page count in __init_zone_device_page(). I wasn't clear enough in the commit. Maybe we can remove the 'set_page_count(page, 0)',  But I didn't do that, just to be safe.