From patchwork Mon Jun 10 14:37:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13692135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61D9AC27C55 for ; Mon, 10 Jun 2024 14:37:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9ABB6B0092; Mon, 10 Jun 2024 10:37:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4B6D6B0093; Mon, 10 Jun 2024 10:37:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C12AF6B0095; Mon, 10 Jun 2024 10:37:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A4EFD6B0092 for ; Mon, 10 Jun 2024 10:37:55 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4C7D7160F64 for ; Mon, 10 Jun 2024 14:37:55 +0000 (UTC) X-FDA: 82215233310.28.4A2D8A1 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf12.hostedemail.com (Postfix) with ESMTP id 91A9440020 for ; Mon, 10 Jun 2024 14:37:52 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ts/c8EPI"; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718030272; a=rsa-sha256; cv=none; b=RRWsRQjXGcHVdnflJSduGtcTZoLAWgyKtSVGqv8G5CoCWivQdC77yY8xawjiYjk0n0il+C E5k8E/rMk23SpN7Uv4ao02V6SUFVBJdLfevQ2n/4i2KWWYr+nJuhaR+pAQbAKXaQZ/+T8U VSk6vqSUV4Bziw/BEfGD/7Aw/9JsZeI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ts/c8EPI"; spf=pass (imf12.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718030272; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=SG/dyZ6yYVec9kF9zbpb43vsHp6f4nh5EsedM4bVOP8=; b=1QU+ZQ5BnbJQYOWpUAPPU6vyGvrQjNzKfL/Sr9CMiDO6crsBJBW8hOOyNkNx2OGgrFGxME qCe1h5Z9n2qOjmE316Bs+rFePOg6oln6VxC54Jo8OXUFZnnmrl59muZUqWgA1g4wYc4FJM o5k4EceUvCjmIkSnh0Hlstn6dDVgPzw= Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-57c60b13a56so3256674a12.0 for ; Mon, 10 Jun 2024 07:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718030271; x=1718635071; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SG/dyZ6yYVec9kF9zbpb43vsHp6f4nh5EsedM4bVOP8=; b=Ts/c8EPINtG9+o+Tdm1UDgDs1vNSigA/F/0wQNC83ibrIMNnp4tYCQBlwHh/L+HKEO hsHoQ5uHlV0YBP0BsRJ26B7MqooM9FJgoDv+K8igvU7yulEqP55Ext5cYkFsuf35fNRa /lmnSlobVL4tCE10TMQyCalprNTQsmEsF831yyZbHFOhhDWkqYjIV+gKdhdFm75jIATr JX1PVsCzdF49eHqkKezb2g1rrSuXJuFY0C0Qxd4pKB2a3jtsVQ1wVL4aaUvyUgk4CLhQ C1UmChZkqUgmMFqnFwAyI0jkyM2v0dlvl4ideyaHRpNuGrm0QRhQet07eqjtT9NcOO5m ewNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718030271; x=1718635071; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SG/dyZ6yYVec9kF9zbpb43vsHp6f4nh5EsedM4bVOP8=; b=qWqDqH3Z3G8UqNxr3JYHZrzT2duPJt9g4JoH6DOx2mjaCPinZm20uYauy/OvdEr3OX 4s8fuZuRzMefO4hHp31IZNR5f2XvPclem1VD67JuPKkEh1EsT9ozelP+u5U8dhNCQclg 5M1Juuxdsbijff5WqqhffiPSQkYc8p+OjRaqXMMwV1xYC324Ji2ae6ylJ3p2Fnfozvhc +Zo5eh/O6Ib80n3UfoYND6O7V9WLw08h6dqsvnYUYXBIaSeoxDDHE86+ugUal29eh2SB zVMZnc8BPy+vXCty+n3N34hoXcZ7v5AH5n3tDLaTc8zHIL3nugX/XmlA4RVyR4OCLnaG 5xQA== X-Gm-Message-State: AOJu0YzAAikGpXhgsCPAthF29j8sSkbP+UO49Ypibw+01e7Zg/sWFDHB G4eEpDeTxV2XLnXIDOO1REG0mYKfaOgMItni4hhNpIWxqG82puHhts8BoSYC X-Google-Smtp-Source: AGHT+IH1WfToeBI6yS85Lex0ABL4SSPAQoLDS+R0j6BwyJdCa3fslbflOW0iPXGo3d4NZRPbdjBfpQ== X-Received: by 2002:a50:9f8c:0:b0:57a:2ccb:b3f2 with SMTP id 4fb4d7f45d1cf-57c6e942405mr2918753a12.16.1718030270722; Mon, 10 Jun 2024 07:37:50 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c67432820sm5003741a12.75.2024.06.10.07.37.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2024 07:37:49 -0700 (PDT) From: Wei Yang To: rppt@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH v2] mm/mm_init.c: don't initialize page->lru again Date: Mon, 10 Jun 2024 14:37:42 +0000 Message-Id: <20240610143742.26401-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 91A9440020 X-Stat-Signature: ngf5dm89f6jwi5rmptnz9mbohb89j7h6 X-HE-Tag: 1718030272-908665 X-HE-Meta: U2FsdGVkX1+mno+46ClDSMV14eSOWSvLkJUyblMlsoLaEK+znhxCeVjUF1A6Rc0s6Eb4aAQZAD116KqnCPcDvSzozSFlKB8ST6vpoOQ5qFuhSrk5YyPBxPkWYXhOoanzIXunUwBtjUrpeiqotmEsERyB2o0im0m8QnPu1sUjmb0YEagCt/SaOXIhqIqEBsxIdh3/xmEYE5KXtoxCypCPnYjzxuAOpeT9okjSERpGK2syAw4qGaf1kTxB8qdG0Iva6a9yRcpZ0zABYOCr8PnM/A+KhcGc7sQn+421BlIwtE9cW8606jE4kLbvX+jF0ZApN4PUqgrq5nbpaqQZ7zmMfsB6Oole9bOw6upbTqGjCZ9ikssIgb7sCS9CgLJZx/QmHZgjf2ousk3rLMQl/k5jXlacLEfTTLZ0+gc2KYLYnCQqfAiI4+e0DbmCglxf3lDUNECaHwkv9uC0c93d3eV3Iwz6E/Vtjs+Ms3n2JeqxZCV2LGNPppMrkt1ja1VkYejkr918VmLhz8gmHAFK8GJVJx6INO7nWPxj5CnmyI2VHCm/EHaQSOqdvzISU+6Z5cmg7y9Kv+JPStcmTCIQzNv85XbAMyEqV8voBHF3b9HRWPFX+sdZ5gpUCe0BkncQiOSf1RuPmMYwJN2xr2Q+h2bTf88ZSawDNelTPfAWl5AXu7brV0wpmV2jyVVhvjrSR98BNSNUGjgxilx6dNUA7GJNCM5H37YZcGgFDsxEn97fbgOThqbEhrDdXJVSEyld+JFvmME37Cfqz3ZjBEE48EQuwY6GjAmaRjolpqagUxXw9TOCivj5jWswrwdmCAshpdC5lVaSFCwm443HNRPhUD442W5LLMdxftVNm3I98dp7b9gLoad3AUkoRcdR/EeC42aNabFwpcxWIefU8H6eAb/mkl1hqlL0lv2S18OXuhejVgx4kSl1h0KT+BqG0gMymmLPN5Q8KwmHR3J/kV28hYD FdQTRtog S7YsZRHwuuizBsH9MTV+yGvrHZuihMrqWKaaTHRt3evaPnYgJYKYzEKALNk48GGOGUosHhrm0Vju3FK0Njr8rBHk14ttkVN4XqmMxGTy+wXz7qLRAF5VM12y6yLAoXZw5PUY6yJvwlWWjnozG0EsSNZmgcA8XZmC7VQv70q0ERvzNzm8NoqyUAVkf3VyP14qIpldxq5kSfZoenwNayAqL+FXsjferk64WaV3LF0iTLTaHsaLZ2hz0sqKi/4zR69Pt2CgLVW1UTdFq+m84fy2RBn9YcolusdfZZVOXoTqlzFL0joqWIR07Sl9RWoWm+fXK5Ew+oQx29Wp5l/rfpVVScGhKXmiVlMGWVRPd+dr4AapFPMutjHWuQAzXKvPhe06NswflCFbgBOAh8es0Z5bZTSsz4ZovNUlFsqFeFNdN1qTZP/9JnxYk635rJf6LKgIuyRNuPvdVtJ7pou4vchSrbCTT34CjcfkVLnle7mqNJBUQ4cWpkx2HA7GPALreWrGNGuaRFP1gKzDsh98ZIn7qK5sK0KqYXXduMiFYC15AOAWlMwo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000044, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Current page initialization call flow looks like this with some simplification: setup_arch() paging_init() free_area_init() memmap_init() memmap_init_zone_range() memmap_init_range() defer_init() __init_single_page() mm_core_init() mem_init() memblock_free_all() free_low_memory_core_early() memmap_init_reserved_pages() reserve_bootmem_region() init_reserved_page() __init_single_page() There two cases depends on CONFIG_DEFERRED_STRUCT_PAGE_INIT. * If CONFIG_DEFERRED_STRUCT_PAGE_INIT, pages after first_init_pfn is skipped at defer_init(). Then init_reserved_page() is defined to call __init_single_page() for them. * If !CONFIG_DEFERRED_STRUCT_PAGE_INIT, pages are all initialized by memmap_init_range(). In both cases, after init_reserved_page(), we expect __init_single_page() has done its work to the page, which already initialize page->lru properly. We don't need to do it again. Signed-off-by: Wei Yang --- v2: adjust changelog to put the call flow in it --- mm/mm_init.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 14133a1cfc7b..30379b0e7729 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -759,9 +759,6 @@ void __meminit reserve_bootmem_region(phys_addr_t start, init_reserved_page(start_pfn, nid); - /* Avoid false-positive PageTail() */ - INIT_LIST_HEAD(&page->lru); - /* * no need for atomic set_bit because the struct * page is not visible yet so nobody should