From patchwork Tue Jan 16 13:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronald Monthero X-Patchwork-Id: 188524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp257373dye; Tue, 16 Jan 2024 05:32:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6vVugHISdWCDrG2CcFsK0t7RhF5nS4nKb0iDYgKiQrtMXneNKpEt+vytIE8oNzwRgKjC6 X-Received: by 2002:a17:903:1ce:b0:1d4:dff2:2f6c with SMTP id e14-20020a17090301ce00b001d4dff22f6cmr10232757plh.68.1705411943098; Tue, 16 Jan 2024 05:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705411943; cv=none; d=google.com; s=arc-20160816; b=KDn/sC1TO8mluBocqg5mospZUPQI10eGgc0M1oW4Fy8PV3esCRe+08nv+MMeIX8Co0 YguzdvgwLQEmatt51QUVYV2VirV2BrpqiS75k7MFr3vQwNnsvIWmOYy1QWNoR4qRDQDm v4ZNM1DCZsBVucYMNN0BY7g9EWvAwNk3YVdzo2uEQjN8/eMD+5BhOHUG6A3XK46lllq+ YNCVEgnquPx1wa30TD1cUetx4X895P4YZEMvTgHhdLEGn11Rxr92is3LIlonXi0AJdhf VKLU+lasMJrq8hWeuaPQfJgcZH9wEVnLtGznjutUmYsT5nYVL9ZHLF/qncA/uyq98e8a e1Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=toKzuFniRcNlr/ckldQaNDhULExFRcUqJOSIbFFbNgg=; fh=noem383WeTkWKZbc8RDzr57pWDWbqRCVDBmRxuo6KoA=; b=ad/+ZjozQ+1GCxUWWbSw6tOBO2mGDA7L9i6w4Fy8QygJ21nY5p3nY+kHu4JPsEGWWn Bq3bpn/9DgqnfpTzrmklAuXMuaTpUQnBsS+v7LjtBYrosA8do+H1d74JwqZRvA6vraa5 INMvz76W39KpEaWKrfl+SuGJMRHH3Z9mQM5AJrWXqjPwGjQVuXX0nB+xvyrhx9zLzyyz dWZeFX/W5Vajm+GwR9DLMcLQ9gpXZlGQr56l+BcYzfKF8czi2CAbpQHrzDDFVoYSq0I3 7D3G7APLX7xmT/okRsw79R/CIkwkNv+MTBygPL1ipo/HIAntj2jQ8Eu/vg3W/98tnsHl sBwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iq8OELEY; spf=pass (google.com: domain of linux-kernel+bounces-27422-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27422-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kn5-20020a170903078500b001cf8e9e8813si10725767plb.315.2024.01.16.05.32.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:32:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27422-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iq8OELEY; spf=pass (google.com: domain of linux-kernel+bounces-27422-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27422-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DC0B0284F20 for ; Tue, 16 Jan 2024 13:32:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AD161BDDB; Tue, 16 Jan 2024 13:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iq8OELEY" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 46C541BC55 for ; Tue, 16 Jan 2024 13:32:10 +0000 (UTC) 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-pf1-f177.google.com with SMTP id d2e1a72fcca58-6db786df38dso1881562b3a.0 for ; Tue, 16 Jan 2024 05:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705411929; x=1706016729; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=toKzuFniRcNlr/ckldQaNDhULExFRcUqJOSIbFFbNgg=; b=iq8OELEYdiOz8NYoumXVB+GvTE9hiLxZI/4y2bL7GdbPReCC5etCuHw2/0UG2jYA1P LoUxupjOPEs7ySGUR+YhUurU8bOmixlSkh7WSFfxd9HMhuvSMoak7ILAEsL1pR1XWAFu XbqX57NsMxe2IW/E2/YPX8sEganyBP2SylyMcvGBiMYn2USqbMvD0/6U5rGkEget4aDJ GHv5FIrx/HCKR0x3tOg5ZUb2HGokcP28yIowpa4s/zM7GUDk2Uc+BkJu+wTy8QtJ/TpI SLM8fxLFZ7SmKKapTVdaGXGO1WQfF0z8nMNjE0L6Dxh7+um+EqP4OyoNOEwU/2zcq18W 3ShA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705411929; x=1706016729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=toKzuFniRcNlr/ckldQaNDhULExFRcUqJOSIbFFbNgg=; b=lqt8EsISLxJ97vjXiRlZ/EtwSQ2vQjLa7x55FbmOvVUuvqg+dmfjr9lzTN104S/THH 1i/JBVF06MOAtLyZJTTIiIpJUVglrNApDtQrbGWbHcQMP0icGx5erZ0S1K5Pu5UdJ/F4 r4SpRXkJ/cX9ddDZIXHjB4Ug+ik0d2RPasDsBB9L9PwYiZxZ+r96fFGGRIS10R+eRL7/ Y4p/517F+XIAeIqnmeVdUicV58D+suqITQHYk7kah14hjywSM/VGwuxwgvEmPlgjzaIc a7lIz+RwnH9PePPbNVFDMwaBF7xVHw92/8Xq+iwW28YWHQdt3gRtiyyImPT5hwr5A6kt 7iGg== X-Gm-Message-State: AOJu0Yxjtjk9ytveG8CwtbuN8Inba5QWA92FAInsWHpXdRIt7DVa9duu xAmQ/a6oXTW6BOcZcqzfmkY= X-Received: by 2002:a05:6a00:2da2:b0:6da:1833:cb6b with SMTP id fb34-20020a056a002da200b006da1833cb6bmr8654996pfb.59.1705411929442; Tue, 16 Jan 2024 05:32:09 -0800 (PST) Received: from eagle-5590.. ([192.166.246.176]) by smtp.gmail.com with ESMTPSA id d13-20020a056a0010cd00b006da04ab75a8sm9259336pfu.1.2024.01.16.05.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:32:09 -0800 (PST) From: Ronald Monthero To: nphamcs@gmail.com Cc: sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, akpm@linux-foundation.org, chrisl@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ronald Monthero Subject: [PATCH] mm/zswap: Improve with alloc_workqueue() call Date: Tue, 16 Jan 2024 23:31:45 +1000 Message-Id: <20240116133145.12454-1-debug.penguin32@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784962653563192025 X-GMAIL-MSGID: 1788254033503467112 The core-api create_workqueue is deprecated, this patch replaces the create_workqueue with alloc_workqueue. The previous implementation workqueue of zswap was a bounded workqueue, this patch uses alloc_workqueue() to create an unbounded workqueue. The WQ_UNBOUND attribute is desirable making the workqueue not localized to a specific cpu so that the scheduler is free to exercise improvisations in any demanding scenarios for offloading cpu time slices for workqueues. For example if any other workqueues of the same primary cpu had to be served which are WQ_HIGHPRI and WQ_CPU_INTENSIVE. Also Unbound workqueue happens to be more efficient in a system during memory pressure scenarios in comparison to a bounded workqueue. shrink_wq = alloc_workqueue("zswap-shrink", WQ_UNBOUND|WQ_MEM_RECLAIM, 1); Overall the change suggested in this patch should be seamless and does not alter the existing behavior, other than the improvisation to be an unbounded workqueue. Signed-off-by: Ronald Monthero Acked-by: Johannes Weiner Acked-by: Nhat Pham Signed-off-by: Ronald Monthero Signed-off-by: Andrew Morton --- mm/zswap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/zswap.c b/mm/zswap.c index 74411dfdad92..64dbe3e944a2 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1620,7 +1620,8 @@ static int zswap_setup(void) zswap_enabled = false; } - shrink_wq = create_workqueue("zswap-shrink"); + shrink_wq = alloc_workqueue("zswap-shrink", + WQ_UNBOUND|WQ_MEM_RECLAIM, 1); if (!shrink_wq) goto fallback_fail;