Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp477296lqp; Tue, 11 Jun 2024 09:42:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4jqbz7z8kEb/8R8V5Zj/hNWnvdwmyVT82/Zf4hAU0SP2WzjdNFnuQgCiqFKSoxbxYv9S6vlrwxu5oXPtvTHsITjrNVqAwNikU2n9LAw== X-Google-Smtp-Source: AGHT+IE7Byq4yG6lNumB+wzO9UO/pxK2eOkF5x8TSlKdXTXpU661ceWnQHFFNaiWnm6a6Shay+8D X-Received: by 2002:a17:902:d507:b0:1f7:21e2:6d9b with SMTP id d9443c01a7336-1f721e26f59mr43934905ad.24.1718124142914; Tue, 11 Jun 2024 09:42:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718124142; cv=pass; d=google.com; s=arc-20160816; b=k80xEHbycNpiYSiOk5MkSEK2UpIpQxvdW23rmUWPLbcuVyWV823puYArXOo2IzjdxA vvsci07q6+fBk5t8B/G1MbR6clYK8IqMyx75nkkG6GT4F+jGzdhawQ8dAWzymgTYIO6Z BOkMP5koHD6pCbPW+vvcpGrusWMcTrM3mVGEKp8CKbQJPRP55Y4dto30bpe/p4JowmqW KU9zivB9QIkvzIeHoiVs0BPOyBF7dpS8eYtJL9TEPP26ucA3xgKBwPfmoDK+fxs2BNmc X5MY1fvToCxkIsFg6yfAeeu9uYL4FSjeyY2Vii6gCtT2Lgm3Md2k5QPF+2kE6Dp0W6yU Cegg== ARC-Message-Signature: i=2; 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=WDlO2YjOSVSSgyeqWjNamYw1STHKmx/Pjf3CpiwkrYs=; fh=UsKQ0H6/rwdhaa5Hlh3Q0pM+jmpK66+FFNlJt2NxMLA=; b=oaljboiDGJA4uJ9T82H8MllRdjjBo+hwTiGPR8VggEZbji1e7QrN4lt4hmRHW6WHoo UjruydAZV7RZS7Q1lbdGOoT39g7Mq/XNwNfrCXtjhlQ+PnUH5+J9WQs052Jte52SvZPl RxOeeesYYNilXNq3Wz5l/IGgVGHuYlECviFsclrKdukBgmmPmTSOGnE/3DpOVWlTcjGj 2E7rCrx1YVFKjTaflLEof8QgRVSGr+QO5YRAovDO0VeEXS3cMCjXVqMrbZVyTle+FLj1 O80ZWIMPGK/AMZc50mfmyoaw+HJ5q28l8eDM57toaIkRoEqMAcI6G1ALxagf6TXh5p1S 3rtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EcPSHsYf; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210255-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f70838151dsi46446255ad.126.2024.06.11.09.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210255-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=@gmail.com header.s=20230601 header.b=EcPSHsYf; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210255-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 19445B26D7D for ; Tue, 11 Jun 2024 16:33:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43E8D3DBBF; Tue, 11 Jun 2024 16:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EcPSHsYf" Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (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 13D9E481B7 for ; Tue, 11 Jun 2024 16:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718123589; cv=none; b=KiJMf+yinAm7Rwy0kdjo+xLcRboIyrxY7eqn3+Wjd3vsZSGU0maFt7IfPkiAhZ5FtzYs9w9Yx7kxZAfUnj35+vFmXuqbHXIiu+kkG55BRqCyZc0GMYsigA1vxnwZ1tBvylhF0OiEB2oHQ+zmokKH/3LKjgIZBCJ+iPwhNDpmdl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718123589; c=relaxed/simple; bh=THmJ90m9cYRnkYlDMu4a/cd1GwGNBcBPB6kbdS5FHTQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=vBtzaLkgM9QSJFWnB0mVNYg0VeGUIS5hTjgGEMTd7VsUlAwSc3tFbg+pSUJJsXUmiK/tn6trj/Xgj0od31w+1FOW7pmTdEwTlzWuPahYbvvcWttIGCQpJxKYkQlfqcWMpkV8HetSYm15NMWcvXEiJ8Wy+TL5AHjvdOr5DF5cwZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EcPSHsYf; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5b97539a4a5so3176809eaf.2 for ; Tue, 11 Jun 2024 09:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718123587; x=1718728387; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WDlO2YjOSVSSgyeqWjNamYw1STHKmx/Pjf3CpiwkrYs=; b=EcPSHsYfVpXpbla2NWQ7jXNr0Qguh1qt/6RyR/p4WmaxRhww130TCb2PgrvyDB03CH vMap8ioetlQDrLE5Wj7NtdDCDIozRGt+Km3MWMKOXJBSuZTP+5sffUPn/A4CmeXjziMX I4whaVrNvwpYHChnypLL+S+0u1SDx/cY+ZkPqaSpFemLElRj3xo2WMYlEFxmcIhzoKsy FXGZWP8w7zTu63Ylx8uxjK31oZyI57SjxFMCZvjJTzv3KZS5NxOnv5EBpMDx2hHHyQXx mniJdKJ08LA3IpbMOQlv1paz4TBqBbB/LRz2kQeUHxn9SXxIGAsFwS5321m+h+eqk8R/ AvYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718123587; x=1718728387; h=content-transfer-encoding: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=WDlO2YjOSVSSgyeqWjNamYw1STHKmx/Pjf3CpiwkrYs=; b=AcYEVQu0ahaGIoaRc0j6yeDMqHKl8uiG7GZ4d++DPORk5sJ9JWN7+gictY069QZEvi j+gc8amhJWG0dh4XhYEBsk2jBDOwET+5FgC3CzPgbxcTxp1BaKGJfqrBrdSfuNFc9SFB +lt7q0eEhAQEfGOyWqNFjON2rYgmTQn4dw1ZN34w86kVV8pu8HFBaSNwbVG9Dp1sFxKz GhYTH1oZM/klDGZFWtO3huwgx6F2hOk8HynQ8wRHzeSi6HYgPVisLC1SwgZM38vKp7q0 5WbiPdS1KZ7y3H7ccVQ6QlMDFTfLFLg5oqAtT/rYz1qdvLUTUgRtts9FFOk2X6Bzl3N3 zaIg== X-Forwarded-Encrypted: i=1; AJvYcCUjjQ9w9nW0B4pubKxzxRj/Jcnhr425MQ5nCz0vkOSLSWqM30l0P55wroGE9W4EEcXqMiFcT1Wr7pgU+bPfFsqxKB0J0jm7BW6sBip2 X-Gm-Message-State: AOJu0Yxy18SxrvP5PSVAr9amoclXBwtg8u/HrCcmqMFcD2y1ehqrCQN9 aX354PNhZAIItgUz06DeG/eGBDqAZ8aVg+VTsjMlxsjBfh1+RBWMP8ghLT8gLcJqCF4PQ4XiOeM L0+RieBwF8Kpx7IF+Gfpgk7SgG9E= X-Received: by 2002:a05:6358:71c8:b0:19f:4c4e:d3c2 with SMTP id e5c5f4694b2df-19f4c4ed5b2mr898974355d.15.1718123586898; Tue, 11 Jun 2024 09:33:06 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240611024516.1375191-1-yosryahmed@google.com> <20240611024516.1375191-2-yosryahmed@google.com> In-Reply-To: <20240611024516.1375191-2-yosryahmed@google.com> From: Nhat Pham Date: Tue, 11 Jun 2024 09:32:56 -0700 Message-ID: Subject: Re: [PATCH v3 2/3] mm: zswap: add zswap_never_enabled() To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Chengming Zhou , Barry Song <21cnbao@gmail.com>, Chris Li , David Hildenbrand , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 10, 2024 at 7:45=E2=80=AFPM Yosry Ahmed = wrote: > > Add zswap_never_enabled() to skip the xarray lookup in zswap_load() if > zswap was never enabled on the system. It is implemented using static > branches for efficiency, as enabling zswap should be a rare event. This > could shave some cycles off zswap_load() when CONFIG_ZSWAP is used but > zswap is never enabled. > > However, the real motivation behind this patch is two-fold: > - Incoming large folio swapin work will need to fallback to order-0 > folios if zswap was ever enabled, because any part of the folio could > be in zswap, until proper handling of large folios with zswap is > added. > > - A warning and recovery attempt will be added in a following change in > case the above was not done incorrectly. Zswap will fail the read if > the folio is large and it was ever enabled. > > Signed-off-by: Yosry Ahmed This LGTM. Reviewed-by: Nhat Pham