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 4B077C3DA6E for ; Sat, 23 Dec 2023 16:52:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 202E36B0071; Sat, 23 Dec 2023 11:52:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B3876B0072; Sat, 23 Dec 2023 11:52:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A21D6B0074; Sat, 23 Dec 2023 11:52:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EFD016B0071 for ; Sat, 23 Dec 2023 11:52:16 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ACF86C01BE for ; Sat, 23 Dec 2023 16:52:16 +0000 (UTC) X-FDA: 81598675872.27.C70F9E4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf04.hostedemail.com (Postfix) with ESMTP id A66E540007 for ; Sat, 23 Dec 2023 16:52:13 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=TvOUNsUM; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703350333; a=rsa-sha256; cv=none; b=MTBU5xxX4NOhZ2WS9C/iEHCryLnOxwjvm21+VT4fmguqg+4LHU9D+SpvVYy7lBthDHMQFN LpeUJI1/ozW0Y927OFH5s08fPrLF+ja6J55k1KHn7hbdMeJaRWqV9urkn2NL7odHk2ADzv r9UIUmfABB3RWkjrou8r76f+pZUvAjY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=TvOUNsUM; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of chrisl@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703350333; 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=ppxfwDwQjhiu1Dnx/u0wemnLjhrr4P4ny/9YjgMHcz8=; b=KO1rhkK3WrhZm7VqSQelQa8+X0ipByCq46mSSymXNPZtPMv4r699qpIzDWMXPTCiczus2c toLANLjiKblwflWty8pzGQ4PXKiKDwKJquK/rsPM3NtNr5wWI6mA3XDUDesYxIo5HAoKuW dmLsTcCwKcbASlDBOtPQeeIPjqfhXa4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id AC789B8095A for ; Sat, 23 Dec 2023 16:52:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 045BBC433CA for ; Sat, 23 Dec 2023 16:52:10 +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-f44.google.com with SMTP id 006d021491bc7-5944d1ce0c7so675306eaf.0 for ; Sat, 23 Dec 2023 08:52:10 -0800 (PST) X-Gm-Message-State: AOJu0YxvPmfT6ecfbg/o9XsSFT04joFf1RQ9KfKif5AZsZMVyuNPw0NB PxA8XaKN6RgaxZJ75/WPF0mNkuWG6yBpfL4P/naktxduQZJH X-Google-Smtp-Source: AGHT+IHGr1NXGE+6bcTT77D/W9kyCjBJC80rwyNqmEFBeF0Ds/jR4ANmw/sWgFJ4OcmyXbgAtPn0yp4o2mol5yL6Mig= 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) 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 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A66E540007 X-Stat-Signature: puzfedmgzhx5e6igi1c9kmp9repzxh6j X-HE-Tag: 1703350333-108674 X-HE-Meta: U2FsdGVkX185ndyBW+IcKUfvanuKdUc82vJUZaWy6fzZmHTcXkYzUbKvYZoSZY44swqtnkhLCAfzg6Ar17a7Xl6K0qGA5T5wU2w/578uBz4w2buI7qNwM+jBIJlYIjMQSvQWPhZA+kw4UukeFR7UaK3YZNm7Fm+X6tn0Oex/UfppOk6k2nghbi2c82H2IrR5/HTFWqRrMMm4omx0CIZihfiATc1QwbDKz7QwO9tZfaFFyqlnn8ePbFelHqT8sxlL4pPNnzaO1n0UJDuU+ikDKPGHtdjxXN8fKDGPa28GPGdC1rAXzKEX4CujPH8Uv1fHd/ycx6vBt6J3n1nPkZBEUJ2yW/uREZzMzb3IUECwpZ0Jq83+TSvX7FWfOr3rVhVYrQaxN7wOsCsFOGxbJkLJVw1m+C723Tsx/nObpn7bUuxbIU4+JlBBmTetuiAow+4UxyVO7HFEVCONefMumcNlu+EK2l0EsI1pFSLA5KbP6pJITQ67SMjCJbCsr3vi38L5bTUcHOhGllKY7/qpVjrOUK3Qbadh5V0NTaJW9rkeKKNl9uoB+AO2vVSHqnxcKJgslSaxs0Ctx4qISx1HW2dS9V/7qtIVke4lso3ZEGR3lYL3sdE6c2EzQR7urskFsmDnlRewQsXTZDtDyzq4DXFbbVSEDB1K/D1TTs86K0uF4EusRzQ0fUgFKWU28BUdt2+7S4gC3uO5HQ1YzAf6mCvSqUikqCAl56HZ8VWyjVUsXh8Zg59k7bGEaz6CGt4n6fywlOeATUgB10exaQ7Rj8GieXUQD+VlQyjcSj+8UPzI+pFWg+KAVsFKjI4RRCZaviMgzpt0GH8r3iWhfyr239oMuT1RHjzzPIIqeAXLJxy87N4+FVa5Cas210UZ0mj+PFjl6SkKDtTvtgmWj2a0DpZEuqtPpMAnEGzqWpjUbvu1NwqTW1OZTg5CpLSHbZQR66PFrbi97hKrAE8vK/hrEz4 MuKv6su0 pjyxFIB5HKhRhpW4QwHCMtfrNAZEAtwa63ziyZkilrfdNqICZNRNZVsJGK9tLgqGowCDWNEReqmog6Ll7n58jZDkCRWSUsphLN/CHaq8pX8r7caI+gk309ypHhSn+TV93xZNffHwRdpoG7Iwy5VxtwFPlKImi6sr73FTVf6SHdenH57bcfVRdi4aQF2Gr1fx0fovzw8IfZrLePuJslHMIv31gV16LLRiQCXq8H5JdYUWRs/s= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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