From patchwork Sat Apr 13 02:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13628598 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 C0944C4345F for ; Sat, 13 Apr 2024 02:24:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72E276B0095; Fri, 12 Apr 2024 22:24:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E2166B0096; Fri, 12 Apr 2024 22:24:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5586C6B0098; Fri, 12 Apr 2024 22:24:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2817D6B0095 for ; Fri, 12 Apr 2024 22:24:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EA4F3A073D for ; Sat, 13 Apr 2024 02:24:18 +0000 (UTC) X-FDA: 82002914196.04.A95CED4 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf03.hostedemail.com (Postfix) with ESMTP id 341B720003 for ; Sat, 13 Apr 2024 02:24:17 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=KM3T+uT+; spf=pass (imf03.hostedemail.com: domain of 30OwZZgoKCEk9z329lsxporzzrwp.nzxwty58-xxv6lnv.z2r@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=30OwZZgoKCEk9z329lsxporzzrwp.nzxwty58-xxv6lnv.z2r@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=1712975057; 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=GGSekAACS+5O/41JM9vPAXBnj4QEps+gftm74rD23xg=; b=MyuPwYRjVCmdAlaevkY9qbTuXVuJbABQ4N73tMJuh6+fREaJ0pMl4I1HOZD1iasK6ksp2M LS/4Bm0G/vBzcIhyjW9SeknvU2V+dfqG7ucoPeI0D7UAiwUFVi6v1MWTrTcw+xj1AD1Fz5 03Az0CvlpbojUBkAB25x3tjRsHodyXM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712975057; a=rsa-sha256; cv=none; b=QhMyAcbI3nqNPfZExBwocBWcBawlXzMAYXCTFimmoClfj0f9I8zmzr1caIhINMkJfLqCYM nGf2iP7GqqalvaBaNDHK2OchufoVBu0wGheckaYJ1wjqBlHiYjtYo7w8M5y0fx35iIpjEj Cfp06CD6bUHm9otzMWm59vXXv3i3Odo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=KM3T+uT+; spf=pass (imf03.hostedemail.com: domain of 30OwZZgoKCEk9z329lsxporzzrwp.nzxwty58-xxv6lnv.z2r@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=30OwZZgoKCEk9z329lsxporzzrwp.nzxwty58-xxv6lnv.z2r@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61510f72bb3so26029337b3.0 for ; Fri, 12 Apr 2024 19:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712975056; x=1713579856; 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=GGSekAACS+5O/41JM9vPAXBnj4QEps+gftm74rD23xg=; b=KM3T+uT+t+EijGEj0biHJ2t4Bybb0J+sI0GOfPYGr06ZwIo+BjbUkJh7BV3jYPqXoT W8+a2f7WksDHDXtdvui9pDMUGY8/IZNMw7afH+FDErLv5NKd0yvBa4gN3riet4Rc+jdX XXVjGPykg7tu1FKVSjS3WUyaMWznx/YffcfQdOc+NSWdFtjghcHrvb08IKgut0sL0kZ3 8vYddtZElErLbpxsOhOsHJJcPRLM4NhA2Ke+w9a6zel2txSgKKaJzZuvKcd4fhtznU3e ircIcCbgGpPXjfXro2sI6r/dqxi9Kaq+AMPXrm2aXR11kcN7z6hLqgMl5F3pRQy7kp4I +UuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712975056; x=1713579856; 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=GGSekAACS+5O/41JM9vPAXBnj4QEps+gftm74rD23xg=; b=kTbcfi8k350M20vV1sqkRULNSeDkB5vzDI16b+SfFg9hIcEq7pXdylaKaKDXnTfe3f D2kRlXWSoBk/cpUSUalqkr1wr2itIgu5EY6+VjKEtf+TB/aUbqto8V8SZo5SdgDS9abt ly+12llwifcLzpGnwcZM0LjfJrfQic9KPj88poFwwkNDYfwgTZfyIoeGA8JFE+aZB3/f 9R+ZpXnBKCi1lFGrUqOh+8SCQahbAyUExGlF7WzIs55c4hfHS0OtrvegN/rcuON4iRLK Ha60hOaorAlalBY9MzdWEUiK857lDa63Y0c+S80yHGC2QPft4XEfQ9FJ2nr0NzCdJRMe S/pg== X-Forwarded-Encrypted: i=1; AJvYcCVW47mYJqyyxQSrVLrXuYgvw/yb41BS3RLoBYN1zly+sk8LNuyyYToVeFgEUya1wRcgQbijW2DT+cTrojvLH4rzhA8= X-Gm-Message-State: AOJu0Yyi7IwquqWCxZ6HOlrDhifhhJqeo+ZT24U+3To8Z3RTeeASPybL y+4A2lYDXVKQSqr5RR7QyjncjK7GfSqu3z6Uvj1b3BtjUQWD0/ulyADrNPdvRKcp2dEbahFABng 8ZrfT/SkVqQVhBLzvHQ== X-Google-Smtp-Source: AGHT+IFlkK/1syKwe6dvTycUcSxBT93UngoIpgQpJlcuebA8rvVZJNpQ+d8xJDsJnJOws2HVuhkwwg+6UgtMptz/ X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a81:4fcd:0:b0:618:a530:10aa with SMTP id d196-20020a814fcd000000b00618a53010aamr174476ywb.8.1712975056398; Fri, 12 Apr 2024 19:24:16 -0700 (PDT) Date: Sat, 13 Apr 2024 02:24:07 +0000 In-Reply-To: <20240413022407.785696-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20240413022407.785696-1-yosryahmed@google.com> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240413022407.785696-5-yosryahmed@google.com> Subject: [PATCH v3 4/4] 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 , "Maciej S. Szmigiero" X-Stat-Signature: sqyjknieu84e4qne44y3ep9w6y8unz93 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 341B720003 X-Rspam-User: X-HE-Tag: 1712975057-441402 X-HE-Meta: U2FsdGVkX1/IjwkoaNW9Zl7FURrFn3ekmo2r+xlGrU5f1b+rpyQ1lnhnKJz1zrBxTaKG389+Ne9tIn65bqdHP7Y/qVd4350DXf+XUURnuS2wsN/3uW9lseqJP3KH8SV7Y6GjR4HYZ+rGBLOoLpcJDgWFbqdUSTZqQWIY1Jp+Vcf+qM+t+RY2JcBTGeA/WY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2kmhzPqB6ndTgzerh0+yM3kVzS+G2aod/8F5i1HLEWYLahULaob4DiTRuAzbbd708QMELPEL++8Zn2qb8y122D+Vx2XWu/OSsbvpwiTMucajM+6Vx3Gs9xOlc4XdBqZBUeEYge+ecNqzzbVMyF1h1c4fD3Isz4tQksM0H0WldIccFSIpeXHXbHumW1zx4yyPksOGRBnc4WpnNPVofwtVyOaiD4q2npuWacqcCaoedWrN4ICd0Ed+fVPWfrIt3TYnxgEdhVZKh3S0o5PEBm9d6GYytRO57SR67sa7d6sVjRl33f5zmhycFO1p8Wa/0an82SIP4ROtQkcZEp74LskRYhOy1iw0Z35iQC93na7NckouCBR/lshS4qun7nAq8NXnX03Zlte0PVGkQI1ZEcetgn8tdE6t4NLw0+BKnh9stzd2Z6u4tRxVdbaOojuEv0ssn56ARV3aqMIU7gshkSRzL+dOL6EaupuiH0GrXO3D7pMNaWGdyWCfm/F6F0J5J1Tbmu4RxXcTpbSqG46gceN2zcLNzmyWNnIcg+Bz1z6d6QA3Me+HWD5TXJTui6ajdjkHyc= 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/ Cc: "Maciej S. Szmigiero" Signed-off-by: Yosry Ahmed Acked-by: Johannes Weiner Reviewed-by: Nhat Pham Reviewed-by: Chengming Zhou Signed-off-by: Yosry Ahmed --- mm/zswap.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index f1d3204c604bd..243a7c202c6c7 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 @@ -1386,9 +1373,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]; @@ -1466,9 +1450,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)