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 64441C369B1 for ; Wed, 16 Apr 2025 09:38:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ADB432800F3; Wed, 16 Apr 2025 05:38:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8A8A2800D9; Wed, 16 Apr 2025 05:38:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 953C92800F3; Wed, 16 Apr 2025 05:38:34 -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 778B12800D9 for ; Wed, 16 Apr 2025 05:38:34 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 755738043C for ; Wed, 16 Apr 2025 09:38:36 +0000 (UTC) X-FDA: 83339407032.23.364C542 Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com [209.85.222.53]) by imf11.hostedemail.com (Postfix) with ESMTP id 9778B40002 for ; Wed, 16 Apr 2025 09:38:34 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YJ3Z3rW3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.53 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744796314; a=rsa-sha256; cv=none; b=rWCMS6z/q0qnWozFB3yJ7z8x9++AryDXs0yZcC4uImk+Do9edjLAvd3U/hF4wJWoegMBlf Yxpx+ozv9cOxe7hpYEXhUuuNcXgRrXqydHoqy4Wk2XmnTADE4a3/XHl/0kwQAneckc23YV kx6Xnwy8QtqlzPZWkNv/dWofwtbhIHg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YJ3Z3rW3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.53 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=1744796314; 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=HGNLb7eunt65kyYDY5BhHdHIgNTRP+OEJWJQt1g2nDU=; b=La3KWHpsJeE5J7viImOEufxmpz95o635uBaKXdR7HyzrhwibIZURyJSapNaUYkxBq5stQ1 5PhfMLsUi98hDNHsVEFer1RvW1vQ1CEiDd+Vijjwq9ofuM1TYUoTQ8ETSsoe2y61o4Ixbi ro4a8rsEtgfZ7cBGyKQPu1D+FZXDtyE= Received: by mail-ua1-f53.google.com with SMTP id a1e0cc1a2514c-875b8e006f8so312354241.0 for ; Wed, 16 Apr 2025 02:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744796314; x=1745401114; 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=HGNLb7eunt65kyYDY5BhHdHIgNTRP+OEJWJQt1g2nDU=; b=YJ3Z3rW3yn3lVMINPWjQKFsWWfy+IT49vRRo4PPHt8bbEwS7Y2qcnqmw3duIGwrH1J 1Q2IK7h3sx4zMWELAZoXmgEgJ3M3U09kPYLv80OcyYtMPlW35CKY2+/LkJLU3PHX8oe7 T4gL0IAteKHSLdM0aaXwjH12GuHxykrrE3zYzbz/fVDS6D1UKIzhXZgVbAnceCnDf424 qSSUVuGEA76U3dP3pGsy8Es2RJJy946lkrs+VirbqIWbRJLZCKHF8pIHHLMSAaamEvTm YL9lFVz77GNeq6WG/kkxp7lJh6waFsA3N4E29TrygERywdNxlcTTJgMLPjaXxXLFvV8t VpUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744796314; x=1745401114; 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=HGNLb7eunt65kyYDY5BhHdHIgNTRP+OEJWJQt1g2nDU=; b=qNMRV5TQXXMrXzlUqD1QT812UJEewAAXWLl1JozFuPPUbkblHM7qMvOsa678puUlkS 1lC3pb4R6GUZihR9f2zTWK+RfKbRKUVYtAjLH1ecWzsZLUXpjymVUsdjYy1Zhnugo+cy fSsjdD5Mg85bfQRuluY8LuxCmmiTQJnfRRFgIsmk2c/42IKzaqpMrsiMkrJ0jCPcW6Li 7q6Yazz4Lrod4CGjZLcIc2HbM3KLmCIevCi5bxxAQ6de+UbF3ZOavfxhWjYYKW4KToI8 PRwxrIjarGRVgIAaMoD5E6Spu9zHtjdzdCjTIOdJHjncb0uLB7yL/j5en079QPe4aHr3 cxnw== X-Forwarded-Encrypted: i=1; AJvYcCXvOY752pnyfhYVVjPME6MV8Vz1xE6cqylHYqnFkAHanCMqfXu9VLpcBnjlCQu/ujpx9j4rEo+GCw==@kvack.org X-Gm-Message-State: AOJu0YxXMkzMJYUO/NFblTve7L7hoFWHl4Jm0yH3TMvkCNawo/ZnTJYN yxuwffWTxDZC3NPnYigWwODXHq7b9VHkN11ub1Ut+8f4dJrWwPrT92Ia4trXrZAEokM4lw/Pnki GiJAe9lajIU4D9Hhu+V1Tsvm4g+UOAjUFuacUJw== X-Gm-Gg: ASbGncvCkl0VgDXmmUGmHihF/Nm4rmn6RZfpoIvJ8lDbn6Dp86TT/Z0/groHoALpOSD HNtz67eYLyIdP4JL/03qEv7yNnKjml8tZfWTlEeuangqZYP248XuGgvTKUCIoeof3AJN0AZbaR+ CKZOQANrm6o9/CCy7d6pNH6Q== X-Google-Smtp-Source: AGHT+IELdpibobvtt5Kb86Q7ML3F+ZGjbT+Kep31cg3nW5EqxnxDcUCZlOz8FTxSS8hKaMA5HVwE0kqF0TgLw0+FoZM= X-Received: by 2002:a05:6102:53ce:b0:4c1:7ac9:9f67 with SMTP id ada2fe7eead31-4cb591bc3b9mr266822137.5.1744796313681; Wed, 16 Apr 2025 02:38:33 -0700 (PDT) MIME-Version: 1.0 References: <20250412085852.48524-1-21cnbao@gmail.com> <34c54df6-9a7c-475d-9b91-0f8acb118231@redhat.com> <6259cc1d-93a8-4293-9009-a6119166f023@redhat.com> In-Reply-To: <6259cc1d-93a8-4293-9009-a6119166f023@redhat.com> From: Barry Song <21cnbao@gmail.com> Date: Wed, 16 Apr 2025 17:38:22 +0800 X-Gm-Features: ATxdqUHv-sV6W1FvCZuhvrWTo6msnwbYyAFoTYjFi1F0eQxZE1WMVvCxKTYGegk Message-ID: Subject: Re: [RFC PATCH] mm: don't promote exclusive file folios of dying processes To: David Hildenbrand Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Baolin Wang , Johannes Weiner , Matthew Wilcox , Oscar Salvador , Ryan Roberts , Zi Yan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 9778B40002 X-Stat-Signature: h5ngx6ptu6gmgwyjerhq1m7nzp6rztiz X-Rspam-User: X-HE-Tag: 1744796314-940095 X-HE-Meta: U2FsdGVkX1+3Qg+pQcEFg+Ja460qUsccXh8wCaL/doFoS/VoCCEBbYQxMtn6yBiwSSPMfTH74UBb9+sLpF0acz6eYXETyoVITG7gu9dfDfVFygkQG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fuMfbo7wCqU1oDTPv30LeYlaCeqCuwfltZvXXJXRNeqBROVtmCkepi0n05Wne4K/lb7AM95jSZwVfw9B1+qTOGZGJPR/SRadvRBg5AhgoWXroN8yirJu/HnNyraMPfSCcTe8jL7D8MHAIW816KO9eOw7Sg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000453, 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 5:32=E2=80=AFPM David Hildenbrand wrote: > > On 16.04.25 11:24, Barry Song wrote: > > On Wed, Apr 16, 2025 at 4:32=E2=80=AFPM 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 proc= ess? > >> > > > > I don't know. It seems not reasonable at all. if one service crashes du= e to > > SW bug, systemd will restart it immediately. this might be the case pro= moting > > folios might be good. but it is really a bug of the service, not a norm= al case. > > > >> Assume you restart Firefox, would it really matter to promote them whe= n > >> 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 h= as been > > staying in the background inactively for a while. > > > On the other hand, even if users restart firefox immediately, their fol= ios 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 sin= ce 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. > > -- > Cheers, > > David / dhildenb > Thanks Barry