Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp483315rdb; Thu, 18 Jan 2024 09:07:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFB7Z+bEs2AxxrxdwLBsofTC3jcUwfJk5YIUs/AEaZbQw2LlnWHKad1P7BXeTQYS18tp5C X-Received: by 2002:a17:902:f54f:b0:1d7:4f6:930f with SMTP id h15-20020a170902f54f00b001d704f6930fmr1473039plf.82.1705597676240; Thu, 18 Jan 2024 09:07:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705597676; cv=pass; d=google.com; s=arc-20160816; b=PfOBcHGmfinlX5LegzKyqf6guVnUVqU0b+HlStI8Mpp6DQ3/PiaaLQAGFlnkeAjNTX pQsoQ8iJV5zjgzUd3Cl3kgPgZlRLCdWbJaTvqmYOd5s/fdnhlDHWLIrJzc0vnQamXjCP V4xIGxJvJfttHBVlVsuo67OM5pV1p2gcJClxVe5dE9bz+YcJo7TomVY6Ezs4z77zi3Sf FD2i2D8haqgdXpctIwcjReQ+JRxlqu7tdFBkMpbPECmIFNnHtcscz9cE3hMesmgLLJSe NtS9Ib7yV/ty/I7TxsJ8TExDEAI2e1CUWXbQ+8peqSCtLIW0E4QCWu+gCXcb8EQncoNW HKbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=HlYwd4ZgoThSOWDK/BI/ByWriREGCZu6HCgLz+Vx7lU=; fh=WhPuj+kNg30I/nURNpnn9s6W2Cf+t8LtJAh7aAynHVM=; b=mRVTcuvoRwco27rWm+dnata7I+pqlgLeMbpdRrN0IwT96DFIVG26POqMdJvPQI36F+ 2wnwGP2uzO1uQpaGs85ZUgQwV+hj7YCiNP2/7+QFRGG5HU/e6AIQ4lkv7hpmDB2ZWH/C 9V5VI8kfjgATl8CFuZbBtUnPU5K0L4lnv4IQzcx1A3G5uYeOKWpyBY1R08Fh5T5zXkZl RYcfSBoiO4fIC4hfKgAm8b1km4DahHbUmlCvpYal2QQuHECI6iduJIWQXxHVFSszE/+0 WkGM5voUBU9OR8cNuRmPjc2XSk4Ty3tstbq8jV3HpvuDWLsnIPmEsNmZ8u8TxVhSq9yb fkLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k7aVVcZA; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id be2-20020a170902aa0200b001d6ed0ac199si1711766plb.216.2024.01.18.09.07.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 09:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=k7aVVcZA; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30394-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 62686288CC0 for ; Thu, 18 Jan 2024 17:07:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60E3B2C6BD; Thu, 18 Jan 2024 17:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="k7aVVcZA" Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 1F38D25742 for ; Thu, 18 Jan 2024 17:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705597642; cv=none; b=NxLdrFIrdqf7pLxbw7nfEnHxtewCTK5Xho3o9n1sWwyYBeqG8EtTeAuYjmh4UP2mrUPyLcRlkHUhRD5W7RwzG2fUZEzlmdo+pdIESYVlMntOxrqNf0a7lmsodT7dcdhv5LNCaU526FjPD7wdP5LhgrWPRXMyvwHBRyRNJ/qBzbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705597642; c=relaxed/simple; bh=HlYwd4ZgoThSOWDK/BI/ByWriREGCZu6HCgLz+Vx7lU=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version: References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: Content-Type; b=RsEfrhlHVZBnP4e27F74tYtlhhXLfh2JyomeSggXKi7dNwzWt4vOXUa3HP+OqQ6tFXCX+NkVuD8OzJPmDTuJ6Gs5t6/a4Jw5zpc0Nxn5WeHV2JZbuw5/rmRn8H7H9IKO4KasrNl68cfZfmp6hZazI1N6D+S5nuwxfZ3aC55aGW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=k7aVVcZA; arc=none smtp.client-ip=209.85.218.41 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-ej1-f41.google.com with SMTP id a640c23a62f3a-a26fa294e56so1307142266b.0 for ; Thu, 18 Jan 2024 09:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705597639; x=1706202439; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HlYwd4ZgoThSOWDK/BI/ByWriREGCZu6HCgLz+Vx7lU=; b=k7aVVcZAG91ZgvgGHqLQQus/CNIUKv7CBvOaehJ259V1nsQ1NsDBWRAMgXD8FUePSu Ze2xRB6mKfmC2fagT5JZ1BkuKsdgJO/00DEQlpQQp9Swe/d+ATmDeXVqXANRoaWHhV3I ByzP+wsrK1G6T17xEWKnvkL54F2JUI0jSOitM0m3kybWLu5Z+MJsJcFn/E9jYz5lEjzd zoZ0aHRLlSJN+ALep+hZhW0k1MhrDedlq6a96SFxg3W59Fz1PYXGmRCz8P1rqrIUue/a ABdvX8hx9AwIz1MsBcaUFAbJzJU6IHnWBnP/hKHqVyVGL99qLSMJ9fg5xenqIgrLOKyi PtSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705597639; x=1706202439; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HlYwd4ZgoThSOWDK/BI/ByWriREGCZu6HCgLz+Vx7lU=; b=C2rbr6uPt7E3rIX7vNzKr9EZDtB+ENcJHeCUBYgvnWFuyDIjFoXa6PXdC/qaYeDqOh pGSwsAZ+JK3eFp5+xGONH/rCI55JDj9RRfc7Bqcwg8cbCg1OufLHcPiyMmFFYZMNZ9h0 Mmylr0cjBrjIpnguGqBta/hI5QvDe709Nj28gbo7lVYU/Tkmo7mK8RJaxpv1/70ia7Ru SjIbcezWC57WnlHeDCKinTMTD5oS/T8WZQdL3kYjSD/8LGKvSHZO9uLZh4CjkK3PJoOw X9rjvkxGaCsL+ZWHLzg7bQSHWKy7VfsEhJd3lL5xsDICn+mGoHhvgPPFcY2YucZL76Y1 lGTQ== X-Gm-Message-State: AOJu0YyC8mrNOX+V05WV3O+6ZylasxY1PFyBGsfgIvW72L5WLoZV0N48 VjtlGNuEu3E64tth/Z8PKSUmIHZkPgEU78DaiaXhCiaAjU/rXRzjhl6GZ1m1SceU+B48qWcmydP 3pT2L337+l+8/fHVesPpyYZEHQc+UtTenaKBc X-Received: by 2002:a17:906:eb4a:b0:a29:8155:b813 with SMTP id mc10-20020a170906eb4a00b00a298155b813mr781055ejb.85.1705597639224; Thu, 18 Jan 2024 09:07:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240116133145.12454-1-debug.penguin32@gmail.com> <20240118161601.GJ939255@cmpxchg.org> In-Reply-To: <20240118161601.GJ939255@cmpxchg.org> From: Yosry Ahmed Date: Thu, 18 Jan 2024 09:06:43 -0800 Message-ID: Subject: Re: [PATCH] mm/zswap: Improve with alloc_workqueue() call To: Johannes Weiner Cc: Nhat Pham , Ronald Monthero , sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, akpm@linux-foundation.org, chrisl@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" > > > On a different note, I wonder if it would help to perform synchronous > > > reclaim here instead. With our current design, the zswap store failure > > > (due to global limit hit) would leave the incoming page going to swap > > > instead, creating an LRU inversion. Not sure if that's ideal. > > > > The global shrink path keeps reclaiming until zswap can accept again > > (by default, that means reclaiming 10% of the total limit). I think > > this is too expensive to be done synchronously. > > That thresholding code is a bit weird right now. > > It wakes the shrinker and rejects at the same time. We're guaranteed > to see rejections, even if the shrinker has no trouble flushing some > entries a split second later. > > It would make more sense to wake the shrinker at e.g. 95% full and > have it run until 90%. > > But with that in place we also *should* do synchronous reclaim once we > hit 100%. Just enough to make room for the store. This is important to > catch the case where reclaim rate exceeds swapout rate. Rejecting and > going to swap means the reclaimer will be throttled down to IO rate > anyway, and the app latency isn't any worse. But this way we keep the > pipeline alive, and keep swapping out the oldest zswap entries, > instead of rejecting and swapping what would be the hottest ones. I fully agree with the thresholding code being weird, and with waking up the shrinker before the pool is full. What I don't understand is how we can do synchronous reclaim when we hit 100% and still respect the acceptance threshold :/ Are you proposing we change the semantics of the acceptance threshold to begin with?