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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64713C54798 for ; Tue, 5 Mar 2024 21:04:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBABB6B007E; Tue, 5 Mar 2024 16:04:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E6AFE6B0081; Tue, 5 Mar 2024 16:04:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D331A6B0082; Tue, 5 Mar 2024 16:04:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C2F556B007E for ; Tue, 5 Mar 2024 16:04:51 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6C754403B1 for ; Tue, 5 Mar 2024 21:04:51 +0000 (UTC) X-FDA: 81864214782.23.5801CE8 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) by imf16.hostedemail.com (Postfix) with ESMTP id 58715180025 for ; Tue, 5 Mar 2024 21:04:49 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=U0kEBqoE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.44 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709672689; a=rsa-sha256; cv=none; b=STdkfQFKbtIaTvel626CT83uOAjfZg9zSGMQ35tvCEurcaVfuHF0T0RTkf7+mXaYnAkMvX V470pRHwx30XV405gW3fIWwCU3Gs1hlIdcXfnqwrUzWsH+5BbFOC5hN6UM06/vBuUrVo/S QLzZMby65sW2GRGI3V12hjzEhZ5EUWA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=U0kEBqoE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.44 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709672689; h=from:from:sender: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:dkim-signature; bh=tAwIsUxemvd7/34PqpQhR+xQJJ9RTwAKxEAYkBIWXhI=; b=cd7X7Vu5MFoz8viWVMYzdFo+2KjXG+MkKS7KGvtW1c2LfIrHi4FOG7nBGnPNPeKFYeNq9m fBubrYGYiXFnUSoCdYcd27zOSrXHVW9r8NMbO3gB29Ibnl04hfpz3ATYcFsUuP5+n8VQZ7 Y8CCb+DDh9w/UulXP0fkBQTPh16uqvk= Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6ddf26eba3cso4693612a34.0 for ; Tue, 05 Mar 2024 13:04:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709672688; x=1710277488; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tAwIsUxemvd7/34PqpQhR+xQJJ9RTwAKxEAYkBIWXhI=; b=U0kEBqoEFjWpNoUTrul2MPUy1K5HbMb/lUlfZSLkmhrfsFyhnHww4HmOoM9F3/sUcG 1+AIbT5wXzRTC2AYJQcPamsXhGFXmbcziYUs7iA0JFAH0IKnCwrgbhXiudFFm3Tmn3QY V6GjwbtVIaRoatf+5F/V1sjRBTEgQgLuhC+8akAi4LYFUYor+oQJ3+Lm3MAVLWGvFUeN Bpjah9w9CPNaeZQrHletrhVnYp+Xvtqik6s59ZpN5AygEL+MGH8Qahn4qqDMbOzg9MVr Pc8eri+azil3RwJsdkZ01OyeeHk9w0PP4eWvIPwOsm2sWAlYcetkJIeF7FALmLH7+GDR flmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709672688; x=1710277488; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tAwIsUxemvd7/34PqpQhR+xQJJ9RTwAKxEAYkBIWXhI=; b=nBmFCtD0iMlnJV4sQCQgD/aC5X2fVhOeOMz4I9nh7Za9Tf8o0ghdpVvoxMiwaMZHOB 077u/FZySbuVHp5aEhkPG/pvwJwexppxkZzzdnBwv70u4FFptGNjuaJG4JYwGPOYGvU5 ms3wbkmBgtU0X70nXceGsZaVgTlT6sjvzdXOtbE0bex1WFQHZr89FuuqKoit3oPba1VM Fy93A2Z6xs93SUEgu4+p+04LDSdv4TtiUijTGOZ7mCZgsPtJMkYAJIukgD3EZZZZ7I4r sf0PwEhTWvrGeIDr/lZqNB73vLzWXOC/EcqVfODI4gJRoACFbllVshTWYReARaVEExcu 0VpA== X-Forwarded-Encrypted: i=1; AJvYcCUxdDVCcXMG1n58Y8qrQHEskCYu3l5IxzvuXQxn/5FsyP/4T2VHG1oiorMe5MEbbTLIkRAJ7bcqAxVjNql2OuvQRlY= X-Gm-Message-State: AOJu0Yz94Mz+8lDcoRUYD82D53dX2QLFmDbteqhxe0ZR9xTg0nFSiTlH gsNQGN8/eNru1vvvU7lqRt6TDjME+pFkxtoxKp4H3OQKOdo/Ft1P1woGxC6jGWPIFCw5nCIehq+ K/qomYOx5ygzcOQWLoRjrvM1solI= X-Google-Smtp-Source: AGHT+IGqHfHiPcXlchyDKIAA7AhDdnNREUHs8/UYtE4yFUXEhxsXuST0ZeqPgKuw8tQRloA/g5jnZL1K/HKpMOLAhI4= X-Received: by 2002:a9d:7418:0:b0:6e4:f57a:6ade with SMTP id n24-20020a9d7418000000b006e4f57a6ademr3089921otk.36.1709672688337; Tue, 05 Mar 2024 13:04:48 -0800 (PST) MIME-Version: 1.0 References: <20240229183436.4110845-2-yuzhao@google.com> <20240305084116.25103-1-21cnbao@gmail.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Wed, 6 Mar 2024 10:04:37 +1300 Message-ID: Subject: Re: [Chapter One] THP zones: the use cases of policy zones To: Vlastimil Babka Cc: yuzhao@google.com, corbet@lwn.net, linux-mm@kvack.org, lsf-pc@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 58715180025 X-Stat-Signature: y1kx4m6i4up6qhmi3pzmq6jupegropx6 X-HE-Tag: 1709672689-174353 X-HE-Meta: U2FsdGVkX1+zZ29B2NkAFhvVTUSZpuhAfm3BfV5SThEIoMapRAuGajwJDezwi7o3qqWRVacUWTfslh194lqp4QR0888WFUjh64s9Jtnsb5BQPt6EyPYdo7BY0Pc1rwtnb0+P46QIR87xCAqaWySOkBSFBFZO5EaxkQXcKgOPR/PecUBjhsSGZduHxpz6iEqISlnWIHUdHZXxOiNbqR1qqwUQMQRP4+oJfCMnqTSen0sCMtkzAP5SPBbje9QkdZhYm9hZ2glPvtPQAEA4E2PghkPfqH/hplwgVPaZwbYz2qC7IWU8Uc2UYU4Ms502VlXrzhi0AAj0XdWXEXAam8CntwtyKPFzU/oK3j1SUc98rO+QmDNFDtWMgeBf8wJe+7ouHbyDLdaRKail8CKq77MFf45uG1zF4kg39TMySaTc0dgf340Gl0H2uGG4KBznPclKGPE6mBEB1bcT61x35UiinvrEYM3qx+Dil4BtbMQkiOIN7TH6qQmtb3O+r3n1MX+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tests=bogofilter, spamicity=0.002066, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Mar 5, 2024 at 11:07=E2=80=AFPM Vlastimil Babka wr= ote: > > On 3/5/24 09:41, Barry Song wrote: > > We did implement similar idea in the pageblock granularity on OPPO's > > phones by extending two special migratetypes[1]: > > > > * QUAD_TO_TRIP - this is mainly for 4-order mTHP allocation which can u= se > > ARM64's CONT-PTE; but can rarely be splitted into 3 order to dull the p= ain > > of 3-order allocation if and only if 3-order allocation has failed in b= oth > > normal buddy and the below TRIP_TO_QUAD. > > > > * TRIP_TO_QUAD - this is mainly for 4-order mTHP allocation which can u= se > > ARM64's CONT-PTE; but can sometimes be splitted into 3 order to dull th= e > > pain of 3-order allocation if and only if 3-order allocation has failed= in > > normal buddy. > > > > neither of above will be merged into 5 order or above; neither of above > > will be splitted into 2 order or lower. > > > > in compaction, we will skip both of above. I am seeing one disadvantage > > of this approach is that I have to add a separate LRU list in each > > zone to place those mTHP folios. if mTHP and small folios are put > > in the same LRU list, the reclamation efficiency is extremely bad. > > > > A separate zone, on the other hand, can avoid a separate LRU list > > for mTHP as the new zone has its own LRU list. > > But we switched from per-zone to per-node LRU lists years ago? > Is that actually a complication for the policy zones? Or does this work > silently assume multigen lru which (IIRC) works differently? the latter. based on the below code, i believe mglru is different with active/inactive, void lru_gen_init_lruvec(struct lruvec *lruvec) { int i; int gen, type, zone; struct lru_gen_folio *lrugen =3D &lruvec->lrugen; lrugen->max_seq =3D MIN_NR_GENS + 1; lrugen->enabled =3D lru_gen_enabled(); for (i =3D 0; i <=3D MIN_NR_GENS + 1; i++) lrugen->timestamps[i] =3D jiffies; for_each_gen_type_zone(gen, type, zone) INIT_LIST_HEAD(&lrugen->folios[gen][type][zone]); lruvec->mm_state.seq =3D MIN_NR_GENS; } A fundamental difference is that mglru has a different aging and eviction mechanism, This can synchronize the LRUs of each zone to move forward at the same pace while the active/inactive might be unable to compare the ages of folios across zo= nes. > > > > [1] https://github.com/OnePlusOSS/android_kernel_oneplus_sm8650/blob/on= eplus/sm8650_u_14.0.0_oneplus12/mm/page_alloc.c > > > >> > >> [1] https://lore.kernel.org/20240215103205.2607016-1-ryan.roberts@arm.= com/ > >> [2] https://lore.kernel.org/20200928175428.4110504-1-zi.yan@sent.com/ > >> > >> Signed-off-by: Yu Zhao > > Thanks Barry