Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1497098rdb; Sat, 23 Dec 2023 08:52:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmSblynWnAQ/t5ZiAA0LeU/K5HFW+4ytx+f2f2pPW4OkxEYV3h6KkuvSNToPQ7MepVVnFD X-Received: by 2002:a50:8755:0:b0:554:4e4b:7b68 with SMTP id 21-20020a508755000000b005544e4b7b68mr2009903edv.2.1703350339468; Sat, 23 Dec 2023 08:52:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703350339; cv=none; d=google.com; s=arc-20160816; b=C0ZdiweviYW+RZkuTAus46lVUzkLFR0sjXCH/i2yDnpvX6ILI3D5IppiGCs9TUBLPN HCLwa860GMCQnknzTIh8b9SxI4CzTGCMRhF/xocjMHZdQ4KGjbLVU0wjS540EnvjolVL s6jhaHg2deoKVsckKLRBJltz83OOtB0RNe1mG/zOsZ6V/ZIbH+zuGo+86YVj3pSTl1wo 7FX9rEeQNlS/ePBUGhAWixEiYPvB0gavm0y3E1uiyFmepd2d411b2p16fgXntI/N+Kki 4eoJGIRtC4Q+zMArTT/Btg8H8tEG+iA1SPvjMI+aBV3BKtwoh5BX+s53LG45QpoewPxy FM3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ppxfwDwQjhiu1Dnx/u0wemnLjhrr4P4ny/9YjgMHcz8=; fh=j7xgSoSCNoSFrnk5Yf80InsLB9L/HXk8cvxoj58ZfI4=; b=hlUBpVKuASFP4atnzyE+5j2xLMxtCWez1CtmaRRpEi7+zlC33y631jV8oBGM/RPAxl jbJD/6Wl4xwLfLWPIWUVuwSys/rsoTfJeRa4xh+EnNxLSGw2GIh/aYcM6GhmwJUk7/vF gvV+1OT+5Xq5UxSQgEoSxCl+POu6XqCTC5r4HbhIhPuOqHZkY3ok58A+tBpYqNPcxpn/ r2EEvMxgG6jRO+9FmMG3S3J3jb8OH+2BaFgSVV6igt6U/T18foBHTVOd6Fzl8PVBHlca 0JapNrHNVue+NIqZdeZOk2+vi9uACqBj8OHy0PvScQQlW/h1lWrgDDi83MngAlTP5Onf zpEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TvOUNsUM; spf=pass (google.com: domain of linux-kernel+bounces-10504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s23-20020a056402037700b00554376e172asi2284557edw.47.2023.12.23.08.52.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 08:52:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TvOUNsUM; spf=pass (google.com: domain of linux-kernel+bounces-10504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 386A21F22088 for ; Sat, 23 Dec 2023 16:52:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EF5E12E5A; Sat, 23 Dec 2023 16:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TvOUNsUM" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A4512E47 for ; Sat, 23 Dec 2023 16:52:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18B2BC433AB for ; Sat, 23 Dec 2023 16:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703350331; bh=+K5tE5gSoZn3PYmx70RdeXc/KcbTC2vmPiJ01c+ezxw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TvOUNsUM1LyZy2DwzlsvSO71ZwMwGC48uctGlFAMwWZDvq2/4U8Gewa0o1sLkl+7k 1fhl9gc4FYpUu8rd2gh1m0t7j9tFJ4xmQ8MaRxBx6XtJYMuLkaqr2QEAhGTGkYkvUn jhEsjkyt38yGjitZZbkUbaJzsym4ZPVUtf0cJ2Bk2hmvBvBVs7MSSJSHigpo+KEgCl Ijt5HoR1l0IAxk0UplwzEo3hD9VJKN0W6esWhdCCp5tu3BZXbVS/SpG5Jr7gbUWe2G mpClwJ/3X6Ek55zMB8TddDyRLb3iJL1ic1aU/mc+QInBg4LrsIHUov1pTqdZ+DSE5Z 6vu76k00Gcqlg== Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5945ba54d54so310163eaf.3 for ; Sat, 23 Dec 2023 08:52:11 -0800 (PST) X-Gm-Message-State: AOJu0YzlRMihcS2WcwVXD3zQzNYBGOZDrS/biVKutDJoDFKPM+pOzoKO 2/IqrwmWbgv/iZl8+Ol3jDBWOGZ0KlcCA8+Ax5k10UwdPbOo X-Received: by 2002:a05:6358:7e56:b0:170:ec2e:4373 with SMTP id p22-20020a0563587e5600b00170ec2e4373mr3329466rwm.6.1703350330241; Sat, 23 Dec 2023 08:52:10 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231221-async-free-v1-1-94b277992cb0@kernel.org> <20231222115208.ab4d2aeacdafa4158b14e532@linux-foundation.org> In-Reply-To: From: Chris Li Date: Sat, 23 Dec 2023 08:51:58 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: swap: async free swap slot cache entries To: David Rientjes Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wei Xu , Yu Zhao , Greg Thelen , Chun-Tse Shao , Suren Baghdasaryan , Yosry Ahmed , Brain Geffon , Minchan Kim , Michal Hocko , Mel Gorman , Huang Ying , Nhat Pham , Johannes Weiner , Kairui Song , Zhongkun He , Kemeng Shi , Barry Song , Hugh Dickins Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi David, On Fri, Dec 22, 2023 at 10:11=E2=80=AFPM David Rientjes wrote: > > How do you quantify the impact of the delayed swap_entry_free()? > > Since the free and memcg uncharge are now delayed, is there not the > possibility that we stay under memory pressure for longer? (Assuming at > least some users are swapping because of memory pressure.) > > I would assume that since the free and uncharge itself is delayed that in > the pathological case we'd actually be swapping *more* until the async > worker can run. Thanks for raising this interesting question. First of all, the swap_entry_free() does not impact "memory.current". It reduces "memory.swap.current". Technically it is the swap pressure not memory pressure that suffers the extra delay. Secondly, we are talking about delaying up to 64 swap entries for a few microseconds. Where the swap slot cache itself delays the freeing of the entries for an arbitrary amount of time. It is not freed until the cache is full of 64 entries. This delay can be seconds or even minutes. Adding a few microseconds of extra delay to existing seconds delay really makes no difference from the swap pressure point of view. Chris