Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp490025lqp; Thu, 4 Apr 2024 22:38:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXccKfusRw3KNxX1ntTDdVZe86RaTmH65a1gal31htBZ9F/nez533UUpaZPQc2O833E8AqyDWroUoqqdqRNREvabfBX5hJJzkwHuvH0uA== X-Google-Smtp-Source: AGHT+IGaxhUz48OhHvIL6Vs+v02rNTKSZpH20+hAs0eFZ9vIJIVsx+nIKwOBnZgYxEjFnwcR2q4n X-Received: by 2002:a05:6a20:84a4:b0:1a3:32e5:f38a with SMTP id u36-20020a056a2084a400b001a332e5f38amr501602pzd.45.1712295534202; Thu, 04 Apr 2024 22:38:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712295534; cv=pass; d=google.com; s=arc-20160816; b=yQmx3GoesQcSpZq7WIAZJpQ52Lxqj5oofUWkoEgB3Lej1aOWfhmSVNH2bMaKwStH6c OoYBra5zmhrMK5A7Xsrs20b1n+AF1N6d3ChV2+XYZkF96/7ZIUSRGKxE5DoFAiDGCT2f HU0JFfK0WcZdqzHyqzO68LZKYaEGIQJlhYhbrpAvlFGI5zG/miU0UQM8JblxxUEAa/Xy 4pUy7l1wu9RfrQZJqQr8GtjsYInYMXRUWB+rX/CSnmr2RkmbJMwtPy/XZUtnPk1XA4s7 nRfGZ/tpUBx49Po7cK8npvPyWudvFZPvnxQ4lENQzTvNwOAhAHwZDZoQuJkXl/jTFwTS PSAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=lZdonMx397+2pSb+glDTuU5D6tQtRdHssQDj6gK5t2I=; fh=vFkoEnhjYsAJv8nmdMmQvLqtoljiPwrk2AQ1AD4wOng=; b=rf2Ex9kKEerVqREaM8Vl9C/SCoEmakibEAWzmLCCuD2kFKY+RirmbNZCd0+41QW2N2 EF6V9IsutRy9+CMEcv61zSv8rWVcfPtY8dLUOPtKZhwKp6ha2R3fV6BWy5eCOrc8fyaT IBnaCgMNUBqyeDWZOL59Pv+QVIFbrP3p5GwFYugGsRY9twSiYkJ9l6tMnB39Q3o00ZnP RCOVm6XKxBfCbY/ChOeL0J3JFG+z5MnuHNbmwJpMkpNviw5BG0LEgacQVMasjHJZ7Qpz Iycqyx4zLA/6wkBaRUtQg/L1qTOS4j28SfnexpTfXbeEPFkMTtyfu3w07a12FlxlO+c6 C8sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=NB+shMKC; arc=pass (i=1 spf=pass spfdomain=flex--yosryahmed.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-132429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id kd7-20020a17090313c700b001e28a7e8cf7si731094plb.591.2024.04.04.22.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 22:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132429-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=@google.com header.s=20230601 header.b=NB+shMKC; arc=pass (i=1 spf=pass spfdomain=flex--yosryahmed.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-132429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132429-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BEE61B25ACE for ; Fri, 5 Apr 2024 05:36:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 772342C69B; Fri, 5 Apr 2024 05:35:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NB+shMKC" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 0EBC228E34 for ; Fri, 5 Apr 2024 05:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712295324; cv=none; b=kWLQyXrieUrsUQyLIyl4Ta4rxpHGrYfkFeEtl/pti4z8ShOo8NwumetJTDP6/CHytp1fOWGdmQ/CJpOKdLeeRA5TFS01nXXHgNHGvz4u3CYioPf1DyDXPGmgl5HbBxuHvqEtQs4k3KBGYp+Yxz3klaX12pKiYS6IcubDoas2N2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712295324; c=relaxed/simple; bh=ej6MR+jE0o5Q+Vf9YGysbx/68DDREaEp7teXTicm5SM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=O8WKZdAFcHnTOBiqwOlV72uHNagnYGl2qMwiUWVdHrvx+fcEcGpbff1dljljxMXUVtiL0KWOpf96NyqpqJ3/XJI7++RT80Q1k7crosTd+xi/xbqEj0HHgRApmwyszPRH3D2XkwGEajmYJyLE+3nKrkpDgFtEPbsEwULHxI5Q0sA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--yosryahmed.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=NB+shMKC; arc=none smtp.client-ip=209.85.219.201 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=flex--yosryahmed.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc647f65573so3323145276.2 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=vger.kernel.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=NB+shMKCQ+6yvBaUru6SN2XxIBzlxf55phBTD9ETNe5HI0Ych40GsH8Qe0EcVu4WPV ygJxynuON0Dd8dccF7ux5tWzT7LjrpGFz77MfeetVVZDhru/TdhxspLJHl7ndjiE4lPy gNg+2JhZFU7DMlxGuTYjP5RWO2t6U13VTlHCvKvDsGHr64ZX2Wszw7PaN0bMmihoAWE2 VeUtDzyHUIJlAUnNlb5JxuP6qSK3F5kENTEx0kI6Cf/2zdzR+HNALpaTzGxfMxsmurto Y+banMkZdnonVn73DHT8ac4NclyvJTUn+x/fZAR7yNQCf+RTC7+18SCDyipWIrey6u1B MHow== 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=BdxoHNQljNFkNXhtR0Yn6u8oM4tcOqC/+y2ylaNTefkWS1RjMUwIXhJpm8N2GEEfaq j7+Tx7A/I1WtBl88N29F+2ADCJ0zFvCT4QL0dsX8cs+xtQomn77CP8M6+3oLlqhBbQ7m RjBXLyQgIiIi5kyqL6CyvEZSsjDuMh+oPzGsojp4Nm2nTOvpQw0Dn0gwPCOfg/EpchWm 4chszmOdwvvC4Uam9uj9HvzoIQGv90tGiwXUfnDWFxub+4gLeaJjnuQCugOHt5vzTfPS E4pheX+YfrIKhMBsamaMbz6jhVxRfgbiBsuVLXLWO5borTyYejSBUlfLjfyMbjv2PIup zx9w== X-Forwarded-Encrypted: i=1; AJvYcCUn9L54l6dy97iHPCfs3F339N2NYGDgm0yXciwGYnkCVeuJnQEJ3GOA7oVXZMoi4SVwr6nbcCZhdaK++HVytg8GvVGcU//r74m9ldOE X-Gm-Message-State: AOJu0YzL6Ikhli3sEjkHNIVa1zHUJEa4YrGunpZeI2xwPoRUVWq7bed3 XX+UO7Z8llSha0tWV8RGCh389jRVR/5x58z7o4/pG6j/DwGJWnylH4xQ2mlwEO/Eu6jXprXWSGQ BdUx9MCydirpKSqzVlg== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Type: text/plain; charset="UTF-8" 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 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) -- 2.44.0.478.gd926399ef9-goog