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 9B9D6EE4993 for ; Wed, 23 Aug 2023 13:12:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C51C3900020; Wed, 23 Aug 2023 09:12:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C01918E0011; Wed, 23 Aug 2023 09:12:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA205900020; Wed, 23 Aug 2023 09:12:46 -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 9874C8E0011 for ; Wed, 23 Aug 2023 09:12:46 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 74112B0CA2 for ; Wed, 23 Aug 2023 13:12:46 +0000 (UTC) X-FDA: 81155409132.01.A83D4E3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf12.hostedemail.com (Postfix) with ESMTP id 927B84001D for ; Wed, 23 Aug 2023 13:12:44 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jWTBefLr; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692796364; 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=Uz09CIFb4phUja5aPxrRB0e9q5bhxoa70nYLw9mLuHM=; b=pOoHRT9VZlWSzkia92hLOdk5L6GGdPDd0/fYGXGcBqEykngzozj27Oe63fGCK4AzWvKq9W vYlr1mxFbtTY1dEsWZp5hvFQHIWPN2v5juZBa5O1xKkzAsFyvwIjjVwqCHvCu3TtNU7dkK 93iUupRkOyXJVV5bX1ZxgwJAsct7WQ0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692796364; a=rsa-sha256; cv=none; b=ROKHlHKG6Ifibx7aZaFjubio0elhkiZnkUS9vlx5WTnTrb31nil8n7IbFs1sWQLJSwGvjS S9mZ6+OyUBameXrjFJMTQXgBiTc0nQlDc0DrXq3K9swI8rtS3NiR0nENkVj1VNdJadS8WG nkxrEW0994Fy0zyVHbjImUi9XPS0Sqk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jWTBefLr; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com 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-out2.suse.de (Postfix) with ESMTPS id 467D820829; Wed, 23 Aug 2023 13:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1692796362; 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=Uz09CIFb4phUja5aPxrRB0e9q5bhxoa70nYLw9mLuHM=; b=jWTBefLrqe2p82kmhfsYvU/xVcAN6GLUbIIDYYcXdMJBReUCLsL7ElyotvzvcBfOpqzO/t 1hb3KK7+IQXveL1TfELQbWLV8euLDx/p1JGmt5VU/+RbtQbaVs3R/7z0gQg2JU8KqWMciz 7M+WaltLFLrP9qJqGJtUdr9uAG1bdzE= 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 23EB713458; Wed, 23 Aug 2023 13:12:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id woQJBsoF5mSEZwAAMHmgww (envelope-from ); Wed, 23 Aug 2023 13:12:42 +0000 Date: Wed, 23 Aug 2023 15:12:41 +0200 From: Michal Hocko To: Liu Shixin Cc: Yosry Ahmed , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , wangkefeng.wang@huawei.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: vmscan: reclaim anon pages if there are swapcache pages Message-ID: References: <20230822024901.2412520-1-liushixin2@huawei.com> <50c49baf-d04a-f1e3-0d0e-7bb8e22c3889@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <50c49baf-d04a-f1e3-0d0e-7bb8e22c3889@huawei.com> X-Rspamd-Queue-Id: 927B84001D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ybqymfp9m8h4tzyqqoqodx7hsixi9iy6 X-HE-Tag: 1692796364-494306 X-HE-Meta: U2FsdGVkX1/JZJ/lLrfUO188/yZ4YVrYi+n/BzaYYzyjdhT/7SZdrDgypm5G8cPfyAklS1ygF4O0zit5AOTU9g5M41OELMLjwU4BvE4Om/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, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 23-08-23 10:00:58, Liu Shixin wrote: > > > On 2023/8/23 0:35, Yosry Ahmed wrote: > > On Mon, Aug 21, 2023 at 6:54 PM Liu Shixin wrote: > >> When spaces of swap devices are exhausted, only file pages can be reclaimed. > >> But there are still some swapcache pages in anon lru list. This can lead > >> to a premature out-of-memory. > >> > >> This problem can be fixed by checking number of swapcache pages in > >> can_reclaim_anon_pages(). For memcg v2, there are swapcache stat that can > >> be used directly. For memcg v1, use total_swapcache_pages() instead, which > >> may not accurate but can solve the problem. > > Interesting find. I wonder if we really don't have any handling of > > this situation. > I have alreadly test this problem and can confirm that it is a real problem. > With 9MB swap space and 10MB mem_cgroup limit,when allocate 15MB memory, > there is a probability that OOM occurs. Could you be more specific about the test and the oom report? -- Michal Hocko SUSE Labs