Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp881446rdb; Thu, 15 Feb 2024 20:24:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXO+RhMtqEfxIKK0aaFgPeAmdpolIkK3mIMZf1Cttnz3BGZXKqxr4MGKwwDYehqPDpwiO6um04neezBW6FeLHCTofvYWhcj17uYKt5gNQ== X-Google-Smtp-Source: AGHT+IFrNl+9ZPdf/R+fPN3gEXQzGceOws6aqvo+IYhtd7/ZxSgjMpceoLtCzAzW8m9vE62s36dX X-Received: by 2002:a05:6a00:bc2:b0:6e0:e175:1463 with SMTP id x2-20020a056a000bc200b006e0e1751463mr3799066pfu.5.1708057446265; Thu, 15 Feb 2024 20:24:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708057446; cv=pass; d=google.com; s=arc-20160816; b=ArA9VvICIEEL9G/b9REGlXECva8b1/+29s7UoWi0FEJ+3eBpfRTC9esnJkaY94qxyo wr7dK4XYThniAJeY55q/ONpzmoGKoIBpyKCiYL8o6eNXohqdb7LrS/Ufaa/0x7kkPDD7 3JS6pnsT0mIUn6GxdX0ptDyJoPsC9RYETKUXpeggTGcFdjlLvALHBVLBUTgqJXKPMnHI DIo5QnNikVG/CA5rYL6QgHPPiizOz33WZ8KSzVWI+0I0ITGSTWrYtqbyyWP22jV73FfS /u+IjRuNrYbM/hmvjvsoBTvF9QHoDE3/LCb+qAqM99or0EARg3rT09V8PKEBxWoZLCmE 0MXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=CV2CqnlCZdxTYGjAa8ndSv3N6EPoWIxxTs11iVbJlGg=; fh=2ZBfuN5OPAW70fcZW/gLffpt9yatY2p15iWBJCblzmQ=; b=YKimmmjujNXAFfRbOQI15QNDBCUg9/C26NPulV4Q5S+VlPFbv4NZfYCrFDWsT98KEL aJ3x+dUcwbiiqCcjSPrunIjV4su/a0/KTN3bpfnHHYm5ktYX3IqbpiuRHL4xFEHI8FoA WJlUqeMiOiKkvL53Wo+Q8uOoj5tp+w/OhCMcL3Q1+nydZVf9sIHV+pyH+fD393jLV4VQ cZQtxy3R2gDcS2PRaPJ+I6z6t4mzONWHWECWAywy3W8m8TgLcdwJrAa4Lgus9snBhDWy D6lwGZ6eJJZhEaulChogQd9IWydh7roGQYyWf/o1RFdd09CijDzro+booaKjg2Uxeh/S /dog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="JMf7oFB/"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-68049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68049-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c6-20020a6566c6000000b005dbf4efa1f8si2255200pgw.852.2024.02.15.20.24.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:24:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="JMf7oFB/"; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-68049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68049-linux.lists.archive=gmail.com@vger.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E3D08B216B6 for ; Fri, 16 Feb 2024 04:18:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E661E1AADD; Fri, 16 Feb 2024 04:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="JMf7oFB/" 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 CF1DC1AAA5 for ; Fri, 16 Feb 2024 04:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056988; cv=none; b=L2G78DQMnixjdmpGU1O8+u7e5YUBzqITxLOjxewam62lWxn8m9KC5vgeHcFZJXiwKy7BVv6q7b+4D7VuSwKIFvvErcZ7brTr+EPGjlTK488ADPZOzcKOFZBilLJDGFrkgQTqiEZRkiAfNjdbzli9oaLNjhyjyacCcAP3Hr0WuH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056988; c=relaxed/simple; bh=sUxXigIboc9iP68W8TP9S/5UxJ1R1MlA21rkHc06KEQ=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=WlU9bFClOlfRmmR6XCv8agDPcx1CGJhwcsVSrJhZD+Pdi92eL5MTarsTvSJh6g0gkKLb3TwrK8ZUWmoPL1+q7y1cKppp04gnwFdpNk6nQBA7hq6WfDruw3G1HdUoevm0N6H3Ag4JRAXyHT9N9sJIXuGJ4Z+px05XhQlAztWyxYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=JMf7oFB/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2EA5C433F1; Fri, 16 Feb 2024 04:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708056988; bh=sUxXigIboc9iP68W8TP9S/5UxJ1R1MlA21rkHc06KEQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JMf7oFB/ecGdP2c3QkPhYjjbePLbikrAt7dmWv8nrdDMNsNFliGc9DEjRK57jB38B 68YjhDSAUnWKltkJC42+AlGd7wJp6GL21Uiqh0ZYDWJG04sm6wS1WkrEqQBEbWXnQF 11GlZf75R65UA9wZGC0DHB7ZjbQKDqkAjfHESTw0= Date: Thu, 15 Feb 2024 20:16:27 -0800 From: Andrew Morton To: Tim Chen Cc: Chris Li , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wei Xu , Yu Zhao , Greg Thelen , Chun-Tse Shao , Yosry Ahmed , Michal Hocko , Mel Gorman , Huang Ying , Nhat Pham , Kairui Song , Barry Song Subject: Re: [PATCH v4] mm: swap: async free swap slot cache entries Message-Id: <20240215201627.5abd1841192feaa262d545ba@linux-foundation.org> In-Reply-To: <1b9a69d1ecaac45a228eb2993d5d9b8234a84155.camel@linux.intel.com> References: <20240214-async-free-v4-1-6abe0d59f85f@kernel.org> <20240215161114.6bd444ed839f778eefdf6e0a@linux-foundation.org> <1b9a69d1ecaac45a228eb2993d5d9b8234a84155.camel@linux.intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, 15 Feb 2024 17:38:38 -0800 Tim Chen wr= ote: > > What this description lacks is any description of why anyone cares.=20 > >=20 > > The patch clearly decreases overall throughput (speed-vs-latency is a > > common tradeoff). This, please. > > And the "we don't know how to fix this properly so punt it into a > > kernel thread" approach remains lame. For example, the risk that the > > now-liberated allocator can outpace the async freeing, resulting in > > unlimited object windup. >=20 >=20 > Andrew, >=20 > What you are saying about outpacing asyn free is true for v1 and v2 versi= ons of the patch. >=20 > But in this latest version, if another reclaim comes in before the async = free has kicked in, > we would be freeing the whole cache directly, same as original code, with= out waiting > for the async free. It is different from the first version > where you go into the free one at a time mode while waiting for the async= free.=A0 > That was also my objection to the first two versions as you could be in t= his > slow free one at a time mode for a long time. >=20 > So now we should not have unlimited object windup. And we would be doing= free > in batch of 64, either still in the direct path or in the async path. >=20 OK, thanks, I didn't read closely enough, > If the next swap fault comes in very fast, before the async > free gets a chance to run. It will directly free all the swap > cache in the swap fault the same way as previously. And might it be a win to cancel the async_work in this case? Again, without a clear description of the userspace-visible effects of this problem I am groping in the dark. My hands blindly landed upon the question: the overall effect here is to leave worst-case latency unaltered, but to decrease average latency. Does this satisfy the yet-to-be-described requirements? Also, the V4 patch's quoted quantitative testing results are pasted from the V2 patch's. V2 was a fundamentally different implementation.=20 I think it is fair to say that V4 is "untested", with regard to satisfying its runtime objectives.