From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 722A830149F for ; Fri, 24 Apr 2026 04:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777003314; cv=none; b=HwDf9wmgdrQDjV6OktadAsSDqUCpv9ZP4YZxGfH8Hxe7iBHzifVQKx+aG4jXQHqxChD3ACKzhDJuw1vC02ZgCn2+q53l3FDT9Y+6bOxn73rc4okGZqqXHU9UPqnFAvUmbe7Sd/si6c2TCCMcZOHSRIAj4fucykE9RdtmnIlI7wQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777003314; c=relaxed/simple; bh=IrVs7W0qMS6zYtOWBfQMKk0LtX4TQi5hrDgiv5LUf0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rrgSEniI+CgD6wCA0qcd0uMLQ5pPop6L0eXjRMF334jfnG26B6CgkXSRYzwSvfl8sJBccugPalMgeekXY5D4nKBlxBPuNu3azYDQCNC6lvherIIXTJQpguh6fO2Xio5fBT6kx+Tl5quSOPmjFwcqZoXDIVrSAmQrFDU/jYLZN6Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=GhFXBDVc; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="GhFXBDVc" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777003310; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NtcN3Op0ieChDzZc8VELPGrZGUZ27l8eeX+TShLLBmA=; b=GhFXBDVc38OATu0fbD+/9vkf7VvLtY6ejQzjmVAiWIK3txPn+1XYiQUn40RSMddglsjA/5 RNJka4bkNve6DrZ/lCG5g5COj2zsxcDHxow+sW+vK27olu8Wi9x0ja6ZYguoSvFq1IiNkm zafc0JbOAGCFwLVyOg7t58njxyxgjS0= From: Li Wang To: akpm@linux-foundation.org, tj@kernel.org, longman@redhat.com, roman.gushchin@linux.dev, hannes@cmpxchg.org, yosry@kernel.org, jiayuan.chen@linux.dev, nphamcs@gmail.com, chengming.zhou@linux.dev, mkoutny@suse.com, shuah@kernel.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Hocko , Muchun Song , Shakeel Butt Subject: [PATCH v7 3/8] selftests/cgroup: use runtime page size for zswpin check Date: Fri, 24 Apr 2026 12:00:54 +0800 Message-ID: <20260424040059.12940-4-li.wang@linux.dev> In-Reply-To: <20260424040059.12940-1-li.wang@linux.dev> References: <20260424040059.12940-1-li.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT test_zswapin compares memory.stat:zswpin (counted in pages) against a byte threshold converted with PAGE_SIZE. In cgroup selftests, PAGE_SIZE is hardcoded to 4096, which makes the conversion wrong on systems with non-4K base pages (e.g. 64K). As a result, the test requires too many pages to pass and fails spuriously even when zswap is working. Use sysconf(_SC_PAGESIZE) for the zswpin threshold conversion so the check matches the actual system page size. Signed-off-by: Li Wang Cc: Johannes Weiner Cc: Michal Hocko Cc: Michal Koutný Cc: Muchun Song Cc: Nhat Pham Cc: Tejun Heo Cc: Roman Gushchin Cc: Shakeel Butt Reviewed-by: Yosry Ahmed Acked-by: Nhat Pham --- tools/testing/selftests/cgroup/test_zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 47709cbdcdf..37aa83c2f1b 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -245,7 +245,7 @@ static int test_zswapin(const char *root) goto out; } - if (zswpin < MB(24) / PAGE_SIZE) { + if (zswpin < MB(24) / sysconf(_SC_PAGESIZE)) { ksft_print_msg("at least 24MB should be brought back from zswap\n"); goto out; } -- 2.53.0