From patchwork Fri Apr 5 05:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13618548 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 A8BC4CD1284 for ; Fri, 5 Apr 2024 05:35:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E3136B00EC; Fri, 5 Apr 2024 01:35:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 591AC6B00ED; Fri, 5 Apr 2024 01:35:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 433F26B00EE; Fri, 5 Apr 2024 01:35:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 229F26B00EC for ; Fri, 5 Apr 2024 01:35:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B02EB1A10D2 for ; Fri, 5 Apr 2024 05:35:24 +0000 (UTC) X-FDA: 81974365368.19.13FD53C Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf30.hostedemail.com (Postfix) with ESMTP id D55BF80007 for ; Fri, 5 Apr 2024 05:35:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=3ALc5Yqo; spf=pass (imf30.hostedemail.com: domain of 3mo0PZgoKCCsfVZYfHOTLKNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--yosryahmed.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3mo0PZgoKCCsfVZYfHOTLKNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712295322; 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=lZdonMx397+2pSb+glDTuU5D6tQtRdHssQDj6gK5t2I=; b=bP38YCICa940hMii8wpHiQ0X+VJEIzVA7CmdjJeNUlHCF0ApyXxI0CC2RquawWJQfDDmAB Em7ctAV5U+DoJWY03d178bTU8krU1q9RM40iP7u5kigwH6mp9jKT/qhFvEIQZboH4Dcwh+ YZjIdX40oql74JGHmXc4oL/AM4tdG08= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712295322; a=rsa-sha256; cv=none; b=hUZVu2DcoWtasVpjBBY5jZ3thsnAZ2REmRP3x1Eiv4Regb+UTqTFlbjPeE3mfXupW3jnSh VyUJ4j2/jGfDu7ZvhkYK1pAmW4rSCPxHIR0bWE6KVNh9yAC8gycDYwwy5o3XnOM2HAwXzz RiUSiToZ8aoeiUg+Z7YyzZA6qWXZeWk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=3ALc5Yqo; spf=pass (imf30.hostedemail.com: domain of 3mo0PZgoKCCsfVZYfHOTLKNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--yosryahmed.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3mo0PZgoKCCsfVZYfHOTLKNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc693399655so3209076276.1 for ; Thu, 04 Apr 2024 22:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712295322; x=1712900122; 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=lZdonMx397+2pSb+glDTuU5D6tQtRdHssQDj6gK5t2I=; b=3ALc5Yqo9ay8mraaThUG8L8/AfcmTwmUugmmfu2pQOB7FQvivfiqrsPBbfhtPGhIXP anWx/iit2ZN7B7hHJvKmR2R9fBGMlaQbHzMiorPrm6gdgKBmBTaGwZunOHrak7mIZcRH /e+/j8uy1DVF57lZIhxrSNpzkTTuPJ+qeIZ6e0sA8b5U4r1RT//5S+5YcuwptabKy0ti V0UjyBEEaXvAv+aP3BxEGIKLG+9vIbGMeG4JZ3w4Ybmh45bCBKWMopPRxeiZN/puc2Ny cuJK3BciILTTj6D1Mrs91U0l3GxwxXGcgoTfqogbzGE42bvle9TiEaq88aWa2EQUir4V FZIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712295322; x=1712900122; 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=lZdonMx397+2pSb+glDTuU5D6tQtRdHssQDj6gK5t2I=; b=Qu/MRbE+q1cpGw6WQNPAiAKe9e+hwaG43aA8ZydZwnoo4I8Fr1FL3XlAcNDsji8LNn OY6KpmWbLTyMokcjwxiExQVVx+yU211HUrTkuvIncXtHWnqm017aug6wXm70eV4Runwc Vjfq/fFO054utAXgxtzTWJFUuw16tvcDcWQrv+ORBn3IqYfWKxyp8trzLzFSfpcr5wi0 fzz3X6/zRYiNAdzE3A/bfPdBcNSQxe2PoDUk86QatUulHa1KBL/l/FaDUJaCP3OuyzIr ScmiV1Hm7pgEY21fu7ICvPoodsc6bDMja96f8mvrQNt9nSDcVGIRXmYwUj7m8E5t+0ro eo2g== X-Forwarded-Encrypted: i=1; AJvYcCVLbiiIXSIZXVVXx1pjGs/9XxLFJC+LbgjpDyb509/cB1vH5erF5h7npweTivUIUPsOAd6HhIeUFRJl1WVDIQ4akIQ= X-Gm-Message-State: AOJu0Ywni3MdoSG9mdsN1Nbew+i0v6Le1gAxUEdwFvKolrzj9ehVmYLI iNumEAr6z+YsJpSY9+s9D4qCLHZ/scoNB/vt9oIgBpzmX73aaD93383j9FNC9X+4kWSwU27xOwo Zco95xPap7agqxyD9dQ== X-Google-Smtp-Source: AGHT+IETG5LR7hNPprfABruUGpnm2Pwpk94U38LlqopJDrjx8AYajOaTbPkYn8vPcJdFb7ROfhozscrxJuJ96B7L X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:1882:b0:dc6:fec4:1c26 with SMTP id cj2-20020a056902188200b00dc6fec41c26mr100165ybb.1.1712295322064; Thu, 04 Apr 2024 22:35:22 -0700 (PDT) Date: Fri, 5 Apr 2024 05:35:10 +0000 In-Reply-To: <20240405053510.1948982-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20240405053510.1948982-1-yosryahmed@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240405053510.1948982-6-yosryahmed@google.com> Subject: [PATCH v2 5/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-Rspamd-Queue-Id: D55BF80007 X-Rspam-User: X-Stat-Signature: ih795cj4wxxfumbyodjkdw6jnxmc19jq X-Rspamd-Server: rspam03 X-HE-Tag: 1712295322-935568 X-HE-Meta: U2FsdGVkX1/M1DEuO5LAqneXOq0zNvnHIdtBeKhT4Fq5u14l/rtLYvBl4jKEZ1DK8U/iQBteCiDJJsVR8kmwwYFIU4NUALoeGxhp5+F2XUbo3aSpAIoCh/EXXVYnpqQGHLBoR7661omZPWin09TcI09rbOzhCAryM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avRqZ9mE6SD2K8s988zt5NneEqM27nipROCebfZyXM7z5tnzi9Sky/XKXIy9Vj2iNJsKYYhrbr/ufnYoPzSzd6PRDZq66x3NR8px4s4D/zdiCdCAsAIeqQODIcr5VKk+JKRJ+ndI6LYUIaaz2hRHLlFRc9DuhSCgYuFsDVhQT+ayhI31XKREAGfrSNQYzQCGjzyO5aAqWrfqpVwAQuU2eB7I3uUD5h2IZ06rwKRH3MpXlCahc84t/8X6LbznROkP+zIJGVwmTqLwx6weWWlNM1NKet+qtROXlLeG6Rj+LAPAFr0WHBkYiq5PimVL3kOxNEPhYatfblsBmCYkp9u8PTB97MxevJrRCtn8grXrUumHsxCM79Q9tqbEDjTIN34Yxz0CjPNXAmCXq2w3ghJup85icYxgix7XSxqd0o4YaysO/4YF435n5j3dgp5UT9s4Yl7rsfu6Fi5TZDCIKGa/HTFjCvac53fsn+6cxd655dwQzEOSjwKKaJptvsE78nV7JTnzzrC5hTvROLY0Fm5Ko6STOeyyLCCK6wp7p89VONEfEANa2B 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 Reviewed-by: Nhat Pham Reviewed-by: Chengming Zhou --- mm/zswap.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 13869d18c13bd..b738435215218 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -140,19 +140,6 @@ static const struct kernel_param_ops zswap_accept_thr_param_ops = { module_param_cb(accept_threshold_percent, &zswap_accept_thr_param_ops, &zswap_accept_thr_percent, 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 @@ -1421,9 +1408,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]; @@ -1512,9 +1496,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)