From patchwork Thu Jun 27 07:59:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13713909 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 4A9D6C2BD09 for ; Thu, 27 Jun 2024 08:01:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9987E6B0092; Thu, 27 Jun 2024 04:01:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 947E56B0098; Thu, 27 Jun 2024 04:01:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 836886B0099; Thu, 27 Jun 2024 04:01:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 666FB6B0092 for ; Thu, 27 Jun 2024 04:01:20 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 025751A1BEF for ; Thu, 27 Jun 2024 08:01:19 +0000 (UTC) X-FDA: 82275923520.08.505B413 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) by imf22.hostedemail.com (Postfix) with ESMTP id 06351C0013 for ; Thu, 27 Jun 2024 08:01:17 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=prMdhjOb; spf=pass (imf22.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.180 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719475262; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Qk1uUCNTkSFH7biQuWiNk/WtpQApJrMKSj8t5jy2L9Y=; b=0SosLGoZYK8I6jnFyaZlwu2CUdKNnLddxnzAwQJGL5dj0hlNyey3moMiNqcNb/go3r0Xnf KjpW1OYbCZy2GWq3rAXFNFJzocAeBWhKjRFNCebb6D60ak/k1M57y19TML/5XcUz5gLTCI 5il76fXJO77zDtym2H6yfmxn/6dEHFg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719475262; a=rsa-sha256; cv=none; b=ke/YiKe06/spCn67sDtOeZbkFFn9HjXaQvFJp6ErxSEJIr/5IKq+gYeUJ5NH81TtqBSmGl NQIte5vqbOirv72MTD/zRrS1CBcU7IEKYmXLtPs0zWa3AjnXChNYiB4ERrba9aC0z0hCzd vyraU5nmdIQPd5kej1yppwgkp9BsaiY= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=prMdhjOb; spf=pass (imf22.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.180 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Envelope-To: minchan@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719475275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Qk1uUCNTkSFH7biQuWiNk/WtpQApJrMKSj8t5jy2L9Y=; b=prMdhjObneMqmY2jva8GFCZsP3n12mpBu2Rxgv91T1w+M9vi0E9OM0dp2fDXaN3ihBydAt HefswZUzOVRiAfFFc9aLvsjRB9Cg4GWmChSV3X3LRpMPIlFMNCnTMRAHqWbdjA/vhEOPLj pu7TzfAWCnxSNICAuXajabNjUHkZG+w= X-Envelope-To: senozhatsky@chromium.org X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: chengming.zhou@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou To: minchan@kernel.org, senozhatsky@chromium.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, chengming.zhou@linux.dev Subject: [PATCH 1/2] mm/zsmalloc: fix class per-fullness zspage counts Date: Thu, 27 Jun 2024 15:59:58 +0800 Message-Id: <20240627075959.611783-1-chengming.zhou@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 06351C0013 X-Stat-Signature: dp7ebs6abp5p4hqyfzp8sxdmn65stho6 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719475277-965280 X-HE-Meta: U2FsdGVkX19OoIHP8PrQ8azDJzLaOGfw3x+7/7e7NxcO8Gc+rAmNpsbfIMWruSrS3Zs159ut89vTN15m/YEiSNKrG/IPpXHt9cGbW/nthoC+eRB2C1oWtHRYdCEBk310ueYLl3BAoRdMIaNf2061vAtrrsCiDnS9vsko5ipgJktH5AeiQ6EqjxJ0ttEY9ZhQ0UHKqnOPKGgwFzuTMp8BAHuOliUIdmI98LqnVEymYAZkuyxkorsPk4v5hUboLuWGOy06e+UQoR6AJPAkim1U8OomW6jn7YhG0Ppq6X/Vwluj3Mpa0HSZSl+PQ2pigmkjwbtA2cn+60f7Es44KXn5JjQY4JIGMLZKGm4yX0zSf32Y29qWbF/wQqjwPa4y3iyHk6qi0HY9tmha7VNq5OnGNMLEaHtzORbx9BQCz4xS53qR8ZEuQlFrYUdCeqF/xrYz/zh2M045FdjPaCw3HLmKF1eL3QifnS4dpthvbdqjGYDLcbmYNQoLeFbopOisKAp8EGpRqG1OT3rE7kBUJCgWB0FRttoafzhMFtAEkgupcmLypDf3Es14cm+4h98ODniun61IYpyLGroAIBMG4Lms1pmAq/Bff38OrvKzgiDt1i7fiH9VWXRE1XsWSLdBOv6yDFHn8BaPze0lANT5qztE3YND4y3PAqeJTCv1nTovk4S1L8ASEvyK3WZ+mOEPo7Dl5d3S/D43lLLNkAIN9pcZDyBvbBIsk5ZroCZ/ao7jtwVq3atMGwlALZsMy7ArbU1WcAWLJzgCm4t8XX5y5hCpGVjKXDbRKUQFPK9lTCCY0LS3rfZXkACZZab5WnljXCJyHMhBT0Yxf4xz3XGwE27FPK9MfW9tyM3aQlfNIKAAoNbRmznYxlXHjDHM7H7OrXh5L2AUGZWFGJQxtStBKwiPFCy50Uh7zyH8GvMSlmTnYZI/eausRZfjMXvb1Dnd6ucibYjgiq1PXRtxA/vwZmp XjAciw0P XR0ijD72k7i++jRXJHqPCAmmyYMhidCR1lu9d+dJ0w961Aq8VZq85g3ni/Hw/a5BWyGiZk5IfLuuus1V8lQphTtmuwnlMXJbSP7hKM28h7/TP7T9c+dWkPnmU1imJR4G2fRNH 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: We always use insert_zspage() and remove_zspage() to update zspage's fullness location, which will account correctly. But this special async free path use "splice" instead of remove_zspage(), so the per-fullness zspage count for ZS_INUSE_RATIO_0 won't decrease. Fix it by decreasing when iterate over the zspage free list. Signed-off-by: Chengming Zhou --- mm/zsmalloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index fec1a39e5bbe..7fc25fa4e6b3 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1883,6 +1883,7 @@ static void async_free_zspage(struct work_struct *work) class = zspage_class(pool, zspage); spin_lock(&class->lock); + class_stat_dec(class, ZS_INUSE_RATIO_0, 1); __free_zspage(pool, class, zspage); spin_unlock(&class->lock); }