From patchwork Fri Sep 29 17:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 14731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp4227260vqu; Fri, 29 Sep 2023 11:24:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE35vvJL8z+YJbXO8Qx0KuRw+688en30hCRa8siVxO1qvoIH2UWz8MMDFuJZnW2OzN28HjB X-Received: by 2002:a17:902:f80e:b0:1c5:cbfb:c16f with SMTP id ix14-20020a170902f80e00b001c5cbfbc16fmr4449333plb.25.1696011869334; Fri, 29 Sep 2023 11:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696011869; cv=none; d=google.com; s=arc-20160816; b=pjuoUBsJRsaotGOXHmEtu/OcbMF4/2QASgaBt2tdB6++HEwTpOncs2xjmvJ+WOXJiq N6GGbMrOp2HYlljCxHCc9EAq0wFHaIo+R+kFaNv2Aid3cshNVhH7dwaSkz/XezrF5bUA GAOYrgOSCT23Vnd1LmG/oIOYCz4eLAo8C9t8OrS3uzWGw7mq/6PKNFd2ZcPpxi1m0VEJ 6KVQQ2BL2XRv/FsBPBxTJY8VNSw3OhOhzSVKxgDfyZHt9XtgWkD8Vl66I1LTUWXEkziE /Uma/00cO2CNBrWQm7Z1v9ueIeXP0eT2Mi9ewcJ1ZV1xyCPNmcwvnzUnP24eXH7AFkez Pb2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TzFyE8zAwEgs0Q4irFkzPCcaXtODzp9uLW3nkoQP7WY=; fh=KOqnwf3wLq339F86BgBAUBm2BDBdSDR9Q3xMFmvILoY=; b=Tt8RYDM9JJohyV5CyVqZfkDMJBJWIt4daJpri0c6RmfV4V90VFA4VlzX4P7BFSvwFF AetA8mCG+w5UwZhL7DD6yViJ7yYtVjR7CJevDGvOvAVrRqhK15zTN2Va6IVszaMNdwR1 GI5Xbuv8zk+3KtVweyE3FMEmQ9KX0He/vAdzik7lqmGlXG4cUzyckckKUbGyai6cMt0Q THQcYhGpdxcPIHopE9Hg6fefPT92I46lcOBNRXSfqiTcILyXy9A0NujpTd91uyOYvgVu Yb5Zs+BcHcNtbj2y6C9QzKhvURB2IUIPDUZCce7EWm/Z2tshWpqtDZhB/XiLPLn5IBHq fp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wIX935S8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l5-20020a170903120500b001b84335fb90si22927383plh.286.2023.09.29.11.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 11:24:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wIX935S8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 2BCDA8093D60; Fri, 29 Sep 2023 10:01:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233250AbjI2RAv (ORCPT + 20 others); Fri, 29 Sep 2023 13:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbjI2RAt (ORCPT ); Fri, 29 Sep 2023 13:00:49 -0400 Received: from out-196.mta0.migadu.com (out-196.mta0.migadu.com [IPv6:2001:41d0:1004:224b::c4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BCFC1A7 for ; Fri, 29 Sep 2023 10:00:47 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696006845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TzFyE8zAwEgs0Q4irFkzPCcaXtODzp9uLW3nkoQP7WY=; b=wIX935S8qYqHMzheBghLWseBwTXg1uA6G99i7X59ETLXg1hy/6hwE4578pGY4pr18oxGDf 0YBtfXEc0iFfRQ0YupoeS45PloX5DqzXXqAxUFCYFttQ8eiY63kaH83kIsffU+GPMqThXC oE8YAze/wzkyARxLUmy9qG0feJF3/8M= From: Yajun Deng To: akpm@linux-foundation.org, rppt@kernel.org Cc: mike.kravetz@oracle.com, muchun.song@linux.dev, willy@infradead.org, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH v5 0/2] mm: Don't init and clear page count when MEMINIT_EARLY Date: Sat, 30 Sep 2023 01:00:24 +0800 Message-Id: <20230929170026.2520216-1-yajun.deng@linux.dev> MIME-Version: 1.0 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 10:01:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778397342238830854 X-GMAIL-MSGID: 1778397342238830854 __init_single_page would init page count and __free_pages_core would clear it. A lot of pages don't need to do this when in MEMINIT_EARLY context. It's unnecessary and time-consuming. The 1st patch is allow optional initialization of page count and PG_reserved flag. It's in preparation for the 2nd patch, it didn't change anything. The 2nd patch only init page count for the reserved region, not all of the region when MEMINIT_EARLY. Yajun Deng (2): mm: allow optional initialization of page count and PG_reserved flag mm: Init page count in reserve_bootmem_region when MEMINIT_EARLY mm/hugetlb.c | 2 +- mm/internal.h | 8 +++++++- mm/mm_init.c | 40 ++++++++++++++++++++++++++-------------- mm/page_alloc.c | 20 ++++++++++++-------- 4 files changed, 46 insertions(+), 24 deletions(-)