From patchwork Fri Apr 5 01:35:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13618351 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 25591CD1299 for ; Fri, 5 Apr 2024 01:36:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A95446B00B2; Thu, 4 Apr 2024 21:35:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3FF66B00B5; Thu, 4 Apr 2024 21:35:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 891E56B00B6; Thu, 4 Apr 2024 21:35:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 65F026B00B2 for ; Thu, 4 Apr 2024 21:35:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2EDFE1A0FF7 for ; Fri, 5 Apr 2024 01:35:59 +0000 (UTC) X-FDA: 81973762038.10.A06C03A Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf17.hostedemail.com (Postfix) with ESMTP id 6A03E40009 for ; Fri, 5 Apr 2024 01:35:57 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=PLEUWqaO; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3fFUPZgoKCJsTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3fFUPZgoKCJsTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712280957; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/m5gy6JRDNvLrFZhE09AdQy3FefAqzIV084ImGWBY7k=; b=qcx40GvnoGkax7Kjwdz/UCJ+2MN95B33/f5RLyplmsPIcGUmoKluTa89+AaQX7j1J8Qydx OSeiH4r6uxOaHr3NGZSLLs68VXtu5qfjz6oXeml2p5e67Lc/SGlDWMyn5A7Oy76z5AaSR9 WMJLr6IX0cgjuCSn3ibJgYL+/jKfbLg= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=PLEUWqaO; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3fFUPZgoKCJsTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3fFUPZgoKCJsTJNMT5CH98BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712280957; a=rsa-sha256; cv=none; b=bMCxd73s79H9kDRwMExkMc9yOV1yjJ6OOFZx1U8VD01MnfPGGrPfqHPKt6NOjYHed3F7Z9 Gw8LUlksEYRpr1Xe83xfQUrmhMrtvdDOyF9/bgTull1BoFcOFJuuiniHrsbXkfX4oSP/5M rPy7m5M7LdwUN2suwva1QfFsW6WyVBo= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6156b93c768so31847797b3.1 for ; Thu, 04 Apr 2024 18:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712280956; x=1712885756; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/m5gy6JRDNvLrFZhE09AdQy3FefAqzIV084ImGWBY7k=; b=PLEUWqaOHWcWoKZlMW2oC57mqYL44gVXSgAPyVQLFxTSJWoJ/2igwyZQzoUO/us7ec 1kllIao5OUsE99Oq5IwTgCYQMV+bX3iUADLiSh+Y/CLRq4kjiCW5ZQmR0kl22Ln+lqnc wQoQ8XHHB50UlJIR2czpJusPnF2ClwFuBhJLERiKRZdWL6uQ2mHln0lpACzWe3HgsIlo U6MBVL5g6Gb1E+N0IIyAqF5//U6j2VDFwNtxcS0+B3xanFCL02MPF22GEtA/2DzChZvv W1V/uvzt200pckSoglL/Zx32YhM5XwMoZhpu7d8GFEm0tIOvQ763Vh/q6b8KoKGplply 2ZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712280956; x=1712885756; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/m5gy6JRDNvLrFZhE09AdQy3FefAqzIV084ImGWBY7k=; b=ZZoZH3FbjzqX0QV5qcA8+8bqksrdCQRL7l/0HxXOxJXVfsepTkVJHhVN5qNV2eQoWR KM9Xk2blOYcG3+M+NBG3ELbdgbH6BGNSVkpXsv007eqJaUAtbR3xLNmHaLIWbncl+M00 EfPYcsLEOKrlJgPxpkS/Jk0OaptnwNY/vuW8pwStIawxAqf9yo24sIzolzPsSrWLP3gm h8myNEKdIi9gtJ6DznLlC7VOF3JGAM4NkATpIZH+htrsn+ouADF6dCp1USsyU4x4tCmX U7Y0SaJQ4cpvM4YXH4uT8ffRMc9j5xgcRCTx+HpU1rwewQ5xW9vPTqpobolIT0FwsYc2 YPhw== X-Forwarded-Encrypted: i=1; AJvYcCU68pf97cSKdUml2yYzrOlWeKpdDkPVw8+FciNvV28qtA9F1uLuA8XxQ4eAjuSta23rAs6pEUVyGZXu6MVLEpbwfFQ= X-Gm-Message-State: AOJu0YylOf05j6XISQqIDkybxlG1Le8fA94o+5QWOPhqG7iL2K03HO/d frfZo5eKNqW3mG1KleZPF/20ObZWyoR9Sj2Crx9qRjsfQ414B3GYJ8h71RVoAjVBtNl60T3wsLE Brrh0LdWlqlKiIXeBoQ== X-Google-Smtp-Source: AGHT+IF7f54z2FdS42Ou0yg3jjIJwSZWrUbEzwVPRh5Hihv5pxBYL/oylI81O/dhSX/lYtxqrDRNaVzdafD0Up7i X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:20c5:b0:dc6:d233:ffdd with SMTP id dj5-20020a05690220c500b00dc6d233ffddmr362563ybb.0.1712280956608; Thu, 04 Apr 2024 18:35:56 -0700 (PDT) Date: Fri, 5 Apr 2024 01:35:46 +0000 In-Reply-To: <20240405013547.1859126-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20240405013547.1859126-1-yosryahmed@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240405013547.1859126-5-yosryahmed@google.com> Subject: [PATCH v1 4/5] mm: zswap: remove same_filled module params From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Nhat Pham , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspam-User: X-Stat-Signature: kz7n38hwua46wmyijixgfjy93eqn8q9w X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6A03E40009 X-HE-Tag: 1712280957-384546 X-HE-Meta: U2FsdGVkX18nb2nYzupVNr4dSQFfaEVtPHhIVxZK4q20SCyJenZJiZI8TPuel2TcBnwp+O44i0dKymXrpvBJ0rCQ3JU9zt5Drlmddw9cn89evB5YBFn8e990TCUUVcpm+KsHgqm03pdQZ0uOSX3/Ir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LhBOaBVO5yKnILWhseSDY7j2Fj27Mu36mweHvedEogQ4h8f9gve+rG5mnS3Y9urnzMFVFwGt98xMzHT3LKMcSNwqr4om1fw1GBsGIiO9/8TatsArfHMlbOmlS5uPXsDW1pdZmUCt20sVBmUPkpv20JM/T9vWpfX86YSYsTURY0CdtmVNAlnfn//Af06N6WsS+x8Dp6uyTkNvpRBLGHIEpSjEeNnx+R9C1Gb4mqVJKR+XWxP+pb+m58KP+FLdiWqJlzni6WxeUXiPcDTy+VhvO9kOnsfe1N2FunOC6QndULhq12w7xYZkIzkzNFAvXGaSo/c4hpw0QxlXOsca6wcPhqL1SBcpTmUV6yohT3gXy00o2dO3I/gHWCFFIGVlin/XVLxmEDG84GvlF8UsgBvAt9j4TnnAmoLQDiboYeZch8wAuDmlDxBkFcKtyoHjJJl8dZ0SMNNWP4kfnkTfoQ0GPlUPFi+WNN65QZqasGEKvFd3gyCR3YPUMnDT77jYeH76FrvwQBuqfBH5j38ksWEI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: These knobs offer more fine-grained control to userspace than needed and directly expose/influence kernel implementation; remove them. For disabling same_filled handling, there is no logical reason to refuse storing same-filled pages more efficiently and opt for compression. Scanning pages for patterns may be an argument, but the page contents will be read into the CPU cache anyway during compression. Also, removing the same_filled handling code does not move the needle significantly in terms of performance anyway [1]. For disabling non_same_filled handling, it was added when the compressed pages in zswap were not being properly charged to memcgs, as workloads could escape the accounting with compression [2]. This is no longer the case after commit f4840ccfca25 ("zswap: memcg accounting"), and using zswap without compression does not make much sense. [1]https://lore.kernel.org/lkml/CAJD7tkaySFP2hBQw4pnZHJJwe3bMdjJ1t9VC2VJd=khn1_TXvA@mail.gmail.com/ [2]https://lore.kernel.org/lkml/19d5cdee-2868-41bd-83d5-6da75d72e940@maciej.szmigiero.name/ Signed-off-by: Yosry Ahmed Acked-by: Johannes Weiner --- mm/zswap.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index b92fa37bee277..a85c9235d19d3 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -123,19 +123,6 @@ static unsigned int zswap_accept_thr_percent = 90; /* of max pool size */ module_param_named(accept_threshold_percent, zswap_accept_thr_percent, uint, 0644); -/* - * Enable/disable handling same-value filled pages (enabled by default). - * If disabled every page is considered non-same-value filled. - */ -static bool zswap_same_filled_pages_enabled = true; -module_param_named(same_filled_pages_enabled, zswap_same_filled_pages_enabled, - bool, 0644); - -/* Enable/disable handling non-same-value filled pages (enabled by default) */ -static bool zswap_non_same_filled_pages_enabled = true; -module_param_named(non_same_filled_pages_enabled, zswap_non_same_filled_pages_enabled, - bool, 0644); - /* Number of zpools in zswap_pool (empirically determined for scalability) */ #define ZSWAP_NR_ZPOOLS 32 @@ -1368,9 +1355,6 @@ static bool zswap_is_folio_same_filled(struct folio *folio, unsigned long *value unsigned int pos, last_pos = PAGE_SIZE / sizeof(*page) - 1; bool ret = false; - if (!zswap_same_filled_pages_enabled) - return false; - page = kmap_local_folio(folio, 0); val = page[0]; @@ -1460,9 +1444,6 @@ bool zswap_store(struct folio *folio) goto store_entry; } - if (!zswap_non_same_filled_pages_enabled) - goto freepage; - /* if entry is successfully added, it keeps the reference */ entry->pool = zswap_pool_current_get(); if (!entry->pool)