Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2030209rdb; Sun, 24 Dec 2023 13:13:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC00ex46tNJRnBRU7fcZlDzmlcLLRZzs2hT4Y5lUXUFnSqctjzh/cL4etkmXAsSFG6oPwz X-Received: by 2002:a05:622a:1803:b0:425:4043:50ec with SMTP id t3-20020a05622a180300b00425404350ecmr7384653qtc.123.1703452426942; Sun, 24 Dec 2023 13:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703452426; cv=none; d=google.com; s=arc-20160816; b=RBECkTW1EK2GrPhHjXRySlPq2CW/L6w8hmKi1tH38n4hBC3ehV8le8A0/i+pVjxvOu 45QCJZyidCZJG5q4uJ0XO52/Hc90fvRWVUDgkgqD/Fo+P3Ge1qb5FbfFqIYvUSuuHZEp LDHAH+TaJHVhHpuKWleWwxJQ9pbLAAY/bbyJiTLBSfYLkSqmm8br1LrqF0HgpgI8S+PB wGRAYy9M8XvfvMVD++ys3KX5yVYkgXOYzqREmTRwoW7+unao7f1cGqrZXlAmrgv2CEmN mNuvdIaeZDBcOjqMIjBQ3xuOCFCpWLUCRuc05wCf4y7aK4mHSN4ZhEfae01UyNe7xXDS GldA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=Ld/PwS9QxP35fVzGwf1si/oFabvWirIW5YkS+UkDPZo=; fh=cFiELFUvY6jO/1gMoDbeBo5aMaJXPX4I2B9kgrQYBpM=; b=G1ojKovXcmDOiZxd+hGNVRo1sHnlBjNd2D6mj7pqZfJoXe+oanbHiXo/p/BrjiFsdp X2nu602TUnaIn5579QOC7dPlx91x3hg2oJH1XfEijA7WnAnoN7Vy6I+wHgs6TgCExLW4 Lm/7esXxXDpLTMX+pAnBZJRGc1gA34BZrwJChMalLxYtFScVVZLMYJO5gxn3+S9v5qdi F7nW2mF+2JpX1aEzst+rC30hYBEsTIVkvoLpO1iRYpdLhDHZpN4r4OMqoldYCBsP0I1m 8oHmJRUVLusqcPJvKFDQMQbONCgrR1wLrjH/vqttwzAI8ULTUsdC1n3f43ZPERO5CSsW if3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rtDIJmYI; spf=pass (google.com: domain of linux-kernel+bounces-10825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 19-20020ac85913000000b004277e68ec3dsi8897560qty.446.2023.12.24.13.13.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 13:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rtDIJmYI; spf=pass (google.com: domain of linux-kernel+bounces-10825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9F6651C20BCA for ; Sun, 24 Dec 2023 21:13:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA283E574; Sun, 24 Dec 2023 21:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rtDIJmYI" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C729DDF63 for ; Sun, 24 Dec 2023 21:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d3e4637853so287365ad.0 for ; Sun, 24 Dec 2023 13:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703452418; x=1704057218; darn=vger.kernel.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=Ld/PwS9QxP35fVzGwf1si/oFabvWirIW5YkS+UkDPZo=; b=rtDIJmYI2gswWArQX4wkzjaK7+ATjuDkQvPSKYMSWlLp4EotOC/L/SII9C3oG8d583 7OVLj4EOh2FFXeM1+PUu4OOm0fnFAOQI47hUfIZtg9UaSfdJlPPcx6BQDA5bSjBhO1G6 Mgp6Ho1uu/KVk3tTIEm+eXBt8JhnZ64OsAO/wN5lLV3RLkNpKayPlMzpj979jrxLMhS8 7wK1Mi/D+4V7NnFRpLtyb8wTi2WYeiVgE9Ba50nyqQ6lxA+lk1HnsgYLF30Hzv1Zlr2C jqoTzbZ4qbJ8F76mWfHeWMgXIPWYqYbgzGD3rAZAnMzxzKWrd70HekPqdy3gqZup4+Od +M2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703452418; x=1704057218; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ld/PwS9QxP35fVzGwf1si/oFabvWirIW5YkS+UkDPZo=; b=Q6jd4YuOJ+6RylnEcVWxHVE4I6ARb9p0kgELN+G5HeLwEmNPuH+EBNlGL7OnUSjsE4 tGbquuNgqPH0wd2qu6q5ZU8RN229RLXtGj3apuNzcLZyQCciGnN9sXuZBov8J6huym6A EnbleF2WAU3fgRc9jIjugMtgioKVuYvCjL02dTD5YsBduWwe5/00biF9PN28PAI3Ws8c c7nS4UzHmbAnRe+RNb4VeganOVh684xmecroS9W5t1sLOnGH2fjHpLQ0jA4VPCRsGzJI U3P1IU27SBC0aAe68Wv9M6cgygniVjkILIG0msTDUYNcL6va3zlIaBxIOWggVB5Dyw9L jAOg== X-Gm-Message-State: AOJu0Yx1NPSRNSQGi24QOa6lTd6njCvIcT3vJSB59KYIDbUVr/MkR5Yv OJ2jCTCvmOQ/9pg5jQMcjfm5kiVBMxMa X-Received: by 2002:a17:902:ce85:b0:1d0:a45c:202 with SMTP id f5-20020a170902ce8500b001d0a45c0202mr286301plg.24.1703452417758; Sun, 24 Dec 2023 13:13:37 -0800 (PST) Received: from [2620:0:1008:15:c723:e11e:854b:ac88] ([2620:0:1008:15:c723:e11e:854b:ac88]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c24500b001d078e31cd1sm6859208plg.259.2023.12.24.13.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 13:13:36 -0800 (PST) Date: Sun, 24 Dec 2023 13:13:35 -0800 (PST) From: David Rientjes To: Chris Li 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 Subject: Re: [PATCH] mm: swap: async free swap slot cache entries In-Reply-To: Message-ID: References: <20231221-async-free-v1-1-94b277992cb0@kernel.org> <20231222115208.ab4d2aeacdafa4158b14e532@linux-foundation.org> <0a052cb1-a5c5-4bee-5bd5-fd5569765012@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2003067076-2146640772-1703452416=:2161414" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2003067076-2146640772-1703452416=:2161414 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Sun, 24 Dec 2023, Chris Li wrote: > On Sat, Dec 23, 2023 at 7:01 PM David Rientjes wrote: > > > > On Sat, 23 Dec 2023, Chris Li 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. > > > > What guarantees that the async freeing happens within a few microseconds? > > Linux kernel typically doesn't provide RT scheduling guarantees. You > can change microseconds to milliseconds, my following reasoning still > holds. > What guarantees that the async freeing happens even within 10s? Your responses are implying that there is some deadline by which this freeing absolutely must happen (us or ms), but I don't know of any strong guarantees. If there are no absolute guarantees about when the freeing may now occur, I'm asking how the impact of the delayed swap_entry_free() can be quantified. The benefit to the current implementation is that there *are* strong guarantees about when the freeing will occur and cannot grow exponentially before the async worker can do the freeing. --2003067076-2146640772-1703452416=:2161414--