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 D9455D1F9C5 for ; Tue, 15 Oct 2024 20:10:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CD266B007B; Tue, 15 Oct 2024 16:10:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47D906B0082; Tue, 15 Oct 2024 16:10:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3445B6B0083; Tue, 15 Oct 2024 16:10:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 12FDE6B007B for ; Tue, 15 Oct 2024 16:10:36 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9D3441C71B4 for ; Tue, 15 Oct 2024 20:10:25 +0000 (UTC) X-FDA: 82676929062.05.30F9D4C Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) by imf18.hostedemail.com (Postfix) with ESMTP id BC0501C0009 for ; Tue, 15 Oct 2024 20:10:30 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="BV8FeO/V"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.181 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729023001; a=rsa-sha256; cv=none; b=jpKekikPJQWABnS9+zOH0oId0xv9RvU2SMJwFQ/h48c+1XEHXiUVgG/M/kTyY72omkZqLN SiN3iawnsW0SpbRlZDsaT5KgZS+JOsyFXOXxTZyPekjDsFmA4jRWvHPaFBzGHgCo/rk2va XAxqPRDfKqz+DRP5Tq6QHdgHyazegFQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="BV8FeO/V"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.181 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=1729023001; 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=uoX7+hLaC0C/69Spu6+hOK+MSkV4/XZ7Txsz18m8pxg=; b=69MCXoTL97sPD0ZEbtXTh5bkVjEmVE8wHybKER7fDI9gUPjO182Gv411QCA9lKZ9TAOQCx o6urNiT5aQByCVhWLH/XbE34E7rd1BDcuo5GKJpasfxp4584WggioUxvqzCqfTjfDDUxTL Ae/iFCRUCjGVQpSinMPWMTK1+bpfSCE= Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-50d73699e13so124197e0c.1 for ; Tue, 15 Oct 2024 13:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729023033; x=1729627833; 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=uoX7+hLaC0C/69Spu6+hOK+MSkV4/XZ7Txsz18m8pxg=; b=BV8FeO/VvtINKpcyiva9itQ1fZddK240a3KbG20crE/RylCy2nCVHHqichvwoOhFCj zy0k8PkemkPPQFEnEtZCcfEoNzvpIpJfmJVNZTc1Vg8PUy406hk2zhOBDJbK47PAPCbI CfvPNc72SrP20QCAc9Hio3hp1qT2ljll4avPruAJ5Qe9yn9Nwd/81WL8cikR2CDhMntF R5y/ndgsu1EXqe+81ZHohwzc2VvmlX4PpQAomA+TUnmi/xROmwI+9ZTa49DKBjrAL+Dk U+0hw1Xb8rQXVBLDUvJUoI8Nwp2QGbWapMGCT/kD6ly6HNafidEJ7XYrQFXkWS3nlU+V M4Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729023033; x=1729627833; 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=uoX7+hLaC0C/69Spu6+hOK+MSkV4/XZ7Txsz18m8pxg=; b=gz/QqKhV5160q0Lld/gvnVv8wk8WvNyzzp/TVOSA7Io4uvBA4EqovJOPNKbjp65G57 J2f1zSFMJOwvXOSdNt1b+Vgd0xyp5ddcOQCf+UN3a8YHZylKIOaRcLM2viicUZWc9gEJ wodN1uK7uZTtfXGwMdCRIvnoYh0Y9youotkIeQKJZuTuX8sHFd4vQ57UyKKfo/yHU/4v cl/qUKzVOAj0Lrw1ZD/HqPFAlupj5MJGlV3ge+i0k3Cs3KfXzhz9X4KlJCSIv9c0mazB xzSBbYAiirRE4SiiUK6h4w6LN0Xt1cwrgHxg3kOIfeeEkzZ73eN1fboaqYHkxHSjJj4d Nk7A== X-Forwarded-Encrypted: i=1; AJvYcCXJ1WsBkn3IQpErXsPyMF9H4ndC6SReQqXvZTxml9ylc7wgvYp31pgDXGPIgSES3r/o6vuxul/+CA==@kvack.org X-Gm-Message-State: AOJu0Ywg77NvWRtvuNJyIROi7VT5Swmo7xU1Ntlimm4xyPE2P7AitRPG +R9oeRC2qJ/3Ad2m3+aHwdwBoafNJCN6SRnDX+QQ9DsVxQPzr7uyQNbQic5tQlszs8aJqZ8bz/Z VoigcPM225WiYu39JszEbUt1CGpU= X-Google-Smtp-Source: AGHT+IEsYPsTX4eylMTds43/bzmQobTVe9+2pqaFnScuD8Bd/Iwkduivlw6dP8DrCJn+8z6kLaQ0xdwcdJurNvKh8Ag= X-Received: by 2002:a05:6122:2216:b0:50c:ef20:6bed with SMTP id 71dfb90a1353d-50d1bb18ba6mr11219904e0c.3.1729023032911; Tue, 15 Oct 2024 13:10:32 -0700 (PDT) MIME-Version: 1.0 References: <20240914063746.46290-1-21cnbao@gmail.com> <92f97c8e-f23d-4c6e-9f49-230fb4e96c46@redhat.com> <7dcd3446cd8c4da69242e5d6680c1429@honor.com> In-Reply-To: <7dcd3446cd8c4da69242e5d6680c1429@honor.com> From: Barry Song <21cnbao@gmail.com> Date: Wed, 16 Oct 2024 09:10:21 +1300 Message-ID: Subject: Re: [PATCH RFC] mm: mglru: provide a separate list for lazyfree anon folios To: gaoxu Cc: David Hildenbrand , "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "mhocko@suse.com" , "hailong.liu@oppo.com" , "kaleshsingh@google.com" , "linux-kernel@vger.kernel.org" , "lokeshgidra@google.com" , "ngeoffray@google.com" , "shli@fb.com" , "surenb@google.com" , "yuzhao@google.com" , "minchan@kernel.org" , Barry Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: tg5e6gh3ex7dno9xx4uh8mh336j6ty5f X-Rspamd-Queue-Id: BC0501C0009 X-Rspamd-Server: rspam02 X-HE-Tag: 1729023030-20520 X-HE-Meta: U2FsdGVkX1+7uGA6hPd5NHhocpuU8mVFv0qoPw8Vo0HB2ShYg0dMqO9fgkdNrUw5Viwi7ZIn88hIhICLV5AnXrV8m+ohlItzdjZRZwvKiEUU5fGWcGP9+yLYhHzS/2iW4acRKdx3fmjwIhE4/Hgk6C1Jt5BTz+lmmW+FNdn72sC7VkfuVCUF9skYFcw3vzeP6U8i7JUx091URzngXp2IlLcbl60yClNtbPohWMkFUGiFju/M731KvGHEao3YFbRNhXbaPr71IZYIg57x/PBnMhgYLbafoLGfg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bQCJJmDEyls49PhrnT8pVlCYM2x3NPbkAotfZ1snib+gHtupFJekqdf02/rDqMOCayyGNgHTq0j9f1+1GITOcLtSa5BYThmcIfs38l/y8WHI+lgCp9IazQzNa3a0Fa2dEDEq0ZL89WQEqhQTRzs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.068971, 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, Oct 15, 2024 at 11:03=E2=80=AFPM gaoxu wrote: > > > > > On Wed, Sep 18, 2024 at 12:02=E2=80=AFAM David Hildenbrand > > wrote: > > > > > > On 14.09.24 08:37, Barry Song wrote: > > > > From: Barry Song > > > > > > > > This follows up on the discussion regarding Gaoxu's work[1]. It's > > > > unclear if there's still interest in implementing a separate LRU > > > > list for lazyfree folios, but I decided to explore it out of > > > > curiosity. > > > > > > > > According to Lokesh, MADV_FREE'd anon folios are expected to be > > > > released earlier than file folios. One option, as implemented by Ga= o > > > > Xu, is to place lazyfree anon folios at the tail of the file's > > > > `min_seq` generation. However, this approach results in lazyfree > > > > folios being released in a LIFO manner, which conflicts with LRU > > > > behavior, as noted by Michal. > > > > > > > > To address this, this patch proposes maintaining a separate list fo= r > > > > lazyfree anon folios while keeping them classified under the "file" > > > > LRU type to minimize code changes. These lazyfree anon folios will > > > > still be counted as file folios and share the same generation with > > > > regular files. In the eviction path, the lazyfree list will be > > > > prioritized for scanning before the actual file LRU list. > > > > > > > > > > What's the downside of another LRU list? Do we have any experience on= that? > > > > Essentially, the goal is to address the downsides of using a single LRU= list for files > > and lazyfree anonymous pages - seriously more files re-faults. > > > > I'm not entirely clear on the downsides of having an additional LRU lis= t. While it > > does increase complexity, it doesn't seem to be significant. > > > > Let's wait for Gaoxu's test results before deciding on the next steps. > > I was just > > curious about how difficult it would be to add a separate list, so I to= ok two hours > > to explore it :-) > Hi song, > I'm very sorry, various reasons combined have caused the delay in the res= ults. > > Basic version=EF=BC=9Aandroid V (enable Android ART use MADV_FREE) > Test cases: 60 apps repeatedly restarted, tested for 8 hours; > The test results are as follows: > workingset_refault_anon workingset_refault_file > base 42016805 92010542 > patch 19834873 49383572 > % diff -52.79% -46.33% > > Additionally, a comparative test was conducted on > add-lazyfree-folio-to-lru-tail.patch[1], and the results are as follows: > workingset_refault_anon workingset_refault_file > lazyfree-tail 20313395 52203061 > patch 19834873 49383572 > % diff -2.36% -5.40% > > From the results, it can be seen that this patch is very beneficial and > better than the results in [1]; it can solve the performance issue of hig= h > IO caused by extensive use of MADV_FREE on the Android platform. > Thank you for the testing and data. The results look promising. Would you mind if I send a v2 with the test data and your tag included in the changel= og? I mean: Tested-by: Gao Xu > Test case notes: There is a discrepancy between the test results mentione= d in > [1] and the current test results because the test cases are different. Th= e test > case used in [1] involves actions such as clicking and swiping within the= app > after it starts; For the sake of convenience and result stability, the cu= rrent > test case only involves app startup without clicking and swiping, and the= number > of apps has been increased (30->60). > > 1. https://lore.kernel.org/all/f29f64e29c08427b95e3df30a5770056@honor.com= /T/#u > > > > > > > > -- > > > Cheers, > > > > > > David / dhildenb > > > > > Thanks Barry