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 6B8F1C4167B for ; Thu, 9 Nov 2023 09:53:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0228180031; Thu, 9 Nov 2023 04:53:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F14A08D0073; Thu, 9 Nov 2023 04:53:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDE0580031; Thu, 9 Nov 2023 04:53:35 -0500 (EST) 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 CEE2F8D0073 for ; Thu, 9 Nov 2023 04:53:35 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A62CB1CBB47 for ; Thu, 9 Nov 2023 09:53:35 +0000 (UTC) X-FDA: 81437953590.08.A073865 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf15.hostedemail.com (Postfix) with ESMTP id 743EDA0012 for ; Thu, 9 Nov 2023 09:53:33 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Chxg8Nzc; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699523614; 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=uAxi1znqk3sGJCSNyuUjTVir9QcizsjWhu13JPKmk1Q=; b=V1147OXrHCuBRQqZy4/BvUuUxYM9mjV7UDOpz9Al5aB/CV1MyTnHQtBbRq1U096sgEoUmi 3UwjyfBBHlKNroA2Du15E5s65XDiIJaKqgQikzXVLINkY08fC0hlgI4uzVE9IFtOmelM2+ pLkIw0TV29GD/R3MJJ9gMo7TuOIzHwI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Chxg8Nzc; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699523614; a=rsa-sha256; cv=none; b=IBgBCdyYgbh2ry/tlwaNpqOSUMW5ha/0lpdy1eJW0v5pGjVUGB//ie8+RQfwo/MbQRaNoJ a2NbHjIsQ9zRTQjOxPbFOf8Xq5O7/6gM5BZ+lNbYZwD+GxPvhHxVbaG7nwi/1Zxl9vlJnC oirs5D/L9X29yJosRdw2fPJmCQuBo6g= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C9BC821981; Thu, 9 Nov 2023 09:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699523610; h=from:from:reply-to: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; bh=uAxi1znqk3sGJCSNyuUjTVir9QcizsjWhu13JPKmk1Q=; b=Chxg8NzcVn76MnEz5kl7JNVtqSUwVkxnuEveTXfGaXv1vBRKOJIt3ndyinjPp1TMC4cCO/ VBnyQ1BQfvQIPsL786bdXhDjkLeXb1F7PmvEoKx1u8oxACTPGmOSTaJPXDrXbwc9ISbWdb WsSLyYUqVJxEHlyJPUWrrnx6Rw6WJEM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B85F5138E5; Thu, 9 Nov 2023 09:53:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 87f9LBqsTGWJYQAAMHmgww (envelope-from ); Thu, 09 Nov 2023 09:53:30 +0000 Date: Thu, 9 Nov 2023 10:53:30 +0100 From: Michal Hocko To: Huan Yang Cc: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Matthew Wilcox , Huang Ying , Kefeng Wang , Peter Xu , "Vishal Moola (Oracle)" , Yosry Ahmed , Liu Shixin , Hugh Dickins , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, opensource.kernel@vivo.com Subject: Re: [RFC 0/4] Introduce unbalance proactive reclaim Message-ID: References: <20231108065818.19932-1-link@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 743EDA0012 X-Stat-Signature: 5wtqpmcquhcmjoxdtoaq4cngq841szng X-HE-Tag: 1699523613-975001 X-HE-Meta: U2FsdGVkX18QiBOL90UdTYFQvekQifJK5tc0VS1GsFwmHEkymILThDHpfJY4DV0oOx3g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bDfpG/+pDeTeHtNI7PeHWpZTObafd1ZXkzWRP2bIDn4xX7c0I1Ul/cTorum6Ae4d0aRBEFxaOHwJDR/+uRtTQgTGKa/EkvTGg99as/Moz5Q2k8BbtBPK19OqqBns7WOfnbso5DR+rJ7Fai5c8MG/bQDrKFj5vjB9nEvwrG6DqtbBdvdqZZ8aiHYHPNGs+Msus74wAvszei9KpbGqu2j65AOIQYN7K5X8uCbzhMWW9rb4sFHs0b+DUKV48mAr9eA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 Thu 09-11-23 09:56:46, Huan Yang wrote: > > 在 2023/11/8 22:06, Michal Hocko 写道: > > [Some people who received this message don't often get email from mhocko@suse.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > > > On Wed 08-11-23 14:58:11, Huan Yang wrote: > > > In some cases, we need to selectively reclaim file pages or anonymous > > > pages in an unbalanced manner. > > > > > > For example, when an application is pushed to the background and frozen, > > > it may not be opened for a long time, and we can safely reclaim the > > > application's anonymous pages, but we do not want to touch the file pages. > > Could you explain why? And also why do you need to swap out in that > > case? > > When an application is frozen, it usually means that we predict that > it will not be used for a long time. In order to proactively save some > memory, our strategy will choose to compress the application's private > data into zram. And we will also select some of the cold application > data that we think is in zram and swap it out. > > The above operations assume that anonymous pages are private to the > application. After the application is frozen, compressing these pages > into zram can save memory to some extent without worrying about > frequent refaults. Why don't you rely on the default reclaim heuristics? In other words do you have any numbers showing that a selective reclaim results in a much better behavior? How do you evaluate that? > > And the cost of refaults on zram is lower than that of IO. > > > > > > > This patchset extends the proactive reclaim interface to achieve > > > unbalanced reclamation. Users can control the reclamation tendency by > > > inputting swappiness under the original interface. Specifically, users > > > can input special values to extremely reclaim specific pages. > > Other have already touched on this in other replies but v2 doesn't have > > a per-memcg swappiness > > > > > Example: > > > echo "1G" 200 > memory.reclaim (only reclaim anon) > > > echo "1G" 0 > memory.reclaim (only reclaim file) > > > echo "1G" 1 > memory.reclaim (only reclaim file) > > > > > > Note that when performing unbalanced reclamation, the cgroup swappiness > > > will be temporarily adjusted dynamically to the input value. Therefore, > > > if the cgroup swappiness is further modified during runtime, there may > > > be some errors. > > In general this is a bad semantic. The operation shouldn't have side > > effect that are potentially visible for another operation. > So, maybe pass swappiness into sc and keep a single reclamation ensure that > swappiness is not changed? That would be a much saner approach. > Or, it's a bad idea that use swappiness to control unbalance reclaim. Memory reclaim is not really obliged to consider swappiness. In fact the actual behavior has changed several times in the past and it is safer to assume this might change in the future again. -- Michal Hocko SUSE Labs