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 65DBFC369BD for ; Wed, 16 Apr 2025 14:15:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E247928012A; Wed, 16 Apr 2025 10:15:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DABF1280129; Wed, 16 Apr 2025 10:15:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C268F28012A; Wed, 16 Apr 2025 10:15:38 -0400 (EDT) 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 A184D280129 for ; Wed, 16 Apr 2025 10:15:38 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1FC43C0944 for ; Wed, 16 Apr 2025 14:15:39 +0000 (UTC) X-FDA: 83340105198.28.33C699F Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by imf02.hostedemail.com (Postfix) with ESMTP id 040FA80010 for ; Wed, 16 Apr 2025 14:15:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=a+UTvDoS; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf02.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744812937; a=rsa-sha256; cv=none; b=heMgzwGdi4SkvS0O1V1uva2QtMd3fxDIK1Xo4PA81ttMaQWyyJ3HH3PVqjVkBRCIgsdUqP f+ZJ7nTcgliKFH95u3pStmDMXxvN8FV40WOCcomY6MUyKii0XaRyALPTmymPPb5p8Dk8Pn 3CRSkQQtH8FFU7NUYIhWH5DeGW/gzg8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=a+UTvDoS; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf02.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744812937; 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=/cKdHsgr+iFIgXoIw8sEEZtMyA3jDEAoy2LzI3UQ5/s=; b=kJWUpUhBaFLWSouxXdnAS7DGYEjD8y6BHYdjUAEke5UdA5f6Kb5akxZzHEUcZrosYix/ZT nM+5NeZ8f9mLZguUpg233VlI4J1dwV+0GnlvJlusX1zlJHH7698ROpL/NU5CkTfBa7qFBb gO1l8hipw0RMsS6kW2EVAUk9FjzCz+M= Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7c081915cf3so844147385a.1 for ; Wed, 16 Apr 2025 07:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1744812936; x=1745417736; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=/cKdHsgr+iFIgXoIw8sEEZtMyA3jDEAoy2LzI3UQ5/s=; b=a+UTvDoSQ10bb3P0CqV61NYiNslVFqmHvLqjHnF07hS+ndUep1I9jTz42w5zF0/zvz 5OJyz8aLbof1iwDAeb3klhvtkUEQq9xRs35zIwyo43ZjJpiVvpmJzCntNSgQ6uJRHE+G O8swKSIdlTjcNoRRy2OSqstBnnYojo0Z8d0T7onVUggxKfUI7R/YF5DNOyrr5OIsywvx IOa5c3oRPKWPx1BR/fdgGTE10StM0UlvVejmtfbKp88F+vbbsFYo4UNjHYfZCXmFjASK /OHlO1TWPvAV/DdP/1gXMC6m065R3jIjCPheOPLeQzlyi2hgLpZfQ5tAltauIHbIo1Ny PKuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744812936; x=1745417736; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/cKdHsgr+iFIgXoIw8sEEZtMyA3jDEAoy2LzI3UQ5/s=; b=g/2LFHKtnbdN08YB5Tk45XQ5Qx7YVQjkDUsj6uDLk1f9xOM7RkImOAHjIlnKlrQ0DQ SJS0I2lwBvgB7eigNt2k66cYNwlaCFsBcftZTvdgSQvsb29zG2ifxCZOAF8Kn8cp/uV/ r+T9DYfCzMuqM98YM2EnuZieqemNmn1A7TiQai2o0K6o0AgB80nNMwaj6XP/AW5yQ7Tb yu/w5JaRIAKVLOYAZB0W/7ZePcOufq+EtZtEAJQWymJqIw7RAEhYkqdorpOT2LoRaqJQ ATCycC5hJMNSqVcVis7vhu8A9iKKJ9zaI/vvXC30Iu4iHtCecRsMclsCrIFThhMXWxsP tKug== X-Forwarded-Encrypted: i=1; AJvYcCXzw8mgYEMOiEmPxeVP6ZeY+TIuw0eYGGObHaocVsuPkxNM/XaylLYNDENuJ7EqlDCpZ55KoLx5/A==@kvack.org X-Gm-Message-State: AOJu0Ywn8NP7aOp8ADLQcwbOVCDm6XL3qXUhyrwhkmn9j5W+y0iColSg yFunoww7OFOcG59ntzj+DL9sNJjnwJYHGnEaC//BEueUigDebNij+ARCOYjCpeQ= X-Gm-Gg: ASbGncuYMPgJqVdpGa7wOxkNv9sbYLhndNQJvR4asxzJcUkIT+II7M/CqrERovg1tMZ 0R1BqeEqsVJ/fLi2Zd2RRhhwXpY0Jazxe+FDoAkG+vnTJjAg8Drwfy3OEoOuljdmLkq/7nJ2kHO G7H+GATTxgD9F5xJRZIPkmXPEu3xWidFiWAhe7UKz82fngE+yILjUO+iK3t+A0GGhhfue02YDLP xm9Re9OStSZX65gWxfnZtgKyno4zHYr6Y3RGvjqA5jYoSJzkXfhrftS+ZU02GRSSZjFXE/I2QIK Y7PRORtaPpiggUzEjlpwftmQ0yVOLxmzQYaCx3w= X-Google-Smtp-Source: AGHT+IH3UFcDDuJqR4l0+gbFXCOuCElF8Kzn3pslBk7S1KZFd6OX/vWed0KC6MFjnEGqKBsXsum02A== X-Received: by 2002:a05:620a:468c:b0:7c5:61b2:b84 with SMTP id af79cd13be357-7c918fed5afmr265722985a.19.1744812935816; Wed, 16 Apr 2025 07:15:35 -0700 (PDT) Received: from localhost ([2603:7000:c01:2716:365a:60ff:fe62:ff29]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-7c7a8969cdasm1063935085a.57.2025.04.16.07.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 07:15:35 -0700 (PDT) Date: Wed, 16 Apr 2025 10:15:31 -0400 From: Johannes Weiner To: David Hildenbrand Cc: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Baolin Wang , Matthew Wilcox , Oscar Salvador , Ryan Roberts , Zi Yan Subject: Re: [RFC PATCH] mm: don't promote exclusive file folios of dying processes Message-ID: <20250416141531.GD741145@cmpxchg.org> References: <20250412085852.48524-1-21cnbao@gmail.com> <34c54df6-9a7c-475d-9b91-0f8acb118231@redhat.com> <6259cc1d-93a8-4293-9009-a6119166f023@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 040FA80010 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: m7auekhzb5kq99fjyqq4dyppomsnsnmg X-HE-Tag: 1744812936-377719 X-HE-Meta: U2FsdGVkX18T9wC6oU7l+RRvLpVwJftLYf3I58LlSkC6zl7L7wvGHlYke0Y934zv6Zrmt/X4rrbmBPPsK6sWTsUhSozTGvTAJy+rTup85oCkjojKVC3UFFQ20Dh6NccfMaycdIz4+3e76nvg4LYvem4o2y2bAErsYbDrJTU4KwJbYK1MujgScCT6ClsTBpfyVZE5c8DeWZrJeOJQR8q8vDuuDwkVsl8P3LDbpVo78FR65+6GNUGGLLkhb6kwuoXY7xWI4LAvfo0uMWuGGaVobDzQ5b+MHmc5+w9/GO+d1n5YGbzUMinD5Hz/5qfUoF7wfO/6JRLQXikPn7XbF4kZRfl/htdKTA6cekyVZYpzPuD4tMDbqIQyV7pGjTti/5Bkq04Waf7Q3ZmyfMqoJwMpSJN49gAudOMZrqT0wy8jm2tYXtzkAJkaAeFfPvhypPGBXcBfcnPA7OJoWJP4zhPJhlSxfmduWxjFcrFNCEueCx4aAWQqjmjJX8gyZVwC8fKr4Mjnz3xYP22SvfT4vtPv+ODP703VkMXm094XOkEWjspkuHajFDub9swOX7RG+2OSO56KAndvQ7VpEqS8NIohfnt+TUtGT1IDw4EfZYDBu1IB7b08mo8XEJESG3LY2Dc1328z5/z53weqKIddbHk2O75quGsKvFj3eAkUpRO2SOFvJCvGSSf32dDWB8FGHVmYV0BnJpgiy4hzTnWZVBiTV/U6Qz9U/rTzlOt+Zx7/aXn8Qi9qp7GJXiAsUzcbJUCy2gmqpsJyhruBkUL4B2gSE9GhWitc5QhvrJPhjoyI1zsiUcdFtRSeiIQGccH86gllifzTr47hS9jsutt5erS0z74LztvilZ5//6dwgsByD89oImVhzDuZNShMjUjTaH5Gsb3xBf/6h9T3yPBHV0j1vDvHDad8GumKSfWiwTJDqIol8SM4LlpKkG9qAKPgW9VaqDy448bCEWQ1ue2kVIG LTtlfFDc uOf+WVs4tMF7eH2swuPG4fRAJwuNlt80VZ31D/midHH12k1DWSTgnJDsnydaVKYMmwxp3wh7ddFbos5Q+ONIK3fp4Xtt1+jkIIINskBwJy2P8ReaEO14tmeiBdpbM0eg6KwimoUm3WzuxvNfVq37LffovZVEVbfshT/PQK8PIxZRMEwCN+pPG+GmZUb2y4izzlZ6PoE3ivajipH2TLadXzRTV87WqAbDotQgzEoEUFp2sl69jKX++RDt8g7i5+MbZPdaNomb2NGCC5T+Yl8j4iZsV6B3kt1Q+QIWHOgeuZmNsZxjHvprEGkyEFejw/eobZyh2A48SCrOv9eYSWASfIym7DHFC6bBk0/P6+KW6xWqghuUBWTWISZegbaB1lRNvx58OdpYv7n4gEaHxizNE3L3RIWaKU9nvq1JowMkCym7j+CPB3+7qhp9Mu0gMdo9SmDBQ6tvIJ8+3wDi+zN5JucHpKnFms1snP7f8+QjwG442fd5evmnhyKm/LcxaVWot8AVxZnHkua/zLc702TjX7Kxxtg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.009127, 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 Wed, Apr 16, 2025 at 11:40:31AM +0200, David Hildenbrand wrote: > On 16.04.25 11:38, Barry Song wrote: > > On Wed, Apr 16, 2025 at 5:32 PM David Hildenbrand wrote: > >> > >> On 16.04.25 11:24, Barry Song wrote: > >>> On Wed, Apr 16, 2025 at 4:32 PM David Hildenbrand wrote: > >>>> > >>>> On 12.04.25 10:58, Barry Song wrote: > >>>>> From: Barry Song > >>>>> > >>>>> Promoting exclusive file folios of a dying process is unnecessary and > >>>>> harmful. For example, while Firefox is killed and LibreOffice is > >>>>> launched, activating Firefox's young file-backed folios makes it > >>>>> harder to reclaim memory that LibreOffice doesn't use at all. > >>>> > >>>> Do we know when it is reasonable to promote any folios of a dying process? > >>>> > >>> > >>> I don't know. It seems not reasonable at all. if one service crashes due to > >>> SW bug, systemd will restart it immediately. this might be the case promoting > >>> folios might be good. but it is really a bug of the service, not a normal case. > >>> > >>>> Assume you restart Firefox, would it really matter to promote them when > >>>> unmapping? New Firefox would fault-in / touch the ones it really needs > >>>> immediately afterwards? > >>> > >>> Usually users kill firefox to start other applications (users intend > >>> to free memory > >>> for new applications). For Android, an app might be killed because it has been > >>> staying in the background inactively for a while. > >> > >>> On the other hand, even if users restart firefox immediately, their folios are > >>> probably still in LRU to hit. > >> > >> Right, that's what I'm thinking. > >> > >> So I wonder if we could just say "the whole process is going down; even > >> if we had some recency information, that could only affect some other > >> process, where we would have to guess if it really matters". > >> > >> If the data is important, one would assume that another process would > >> soon access it either way, and as you say, likely it will still be on > >> the LRU to hit. > > > > I'll include this additional information in the v2 version of the patch since > > you think it would be helpful. > > > > Regarding the exclusive flag - I'm wondering whether we actually need to > > distinguish between exclusive and shared folios in this case. The current > > patch uses the exclusive flag mainly to reduce controversy, but even for > > shared folios: does the recency from a dying process matter? The > > recency information only reflects the dying process's usage pattern, which > > will soon be irrelevant. > > Exactly my thoughts. So if we can simplify -- ignore it completely -- > that would certainly be nice. This doesn't sound right to me. Remembering the accesses of an exiting task is very much the point of this. Consider executables and shared libraries repeatedly referenced by short-lived jobs, like shell scripts, compiles etc. MADV_COLD and MADV_PAGEOUT where specifically added for this Android usecase - the rare situation where you *know* those pages are done.