From patchwork Mon Dec 2 18:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13891174 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 998C6E69E81 for ; Mon, 2 Dec 2024 18:42:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E5BB6B008C; Mon, 2 Dec 2024 13:42:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 296B76B0092; Mon, 2 Dec 2024 13:42:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E8046B0093; Mon, 2 Dec 2024 13:42:16 -0500 (EST) 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 E21076B008C for ; Mon, 2 Dec 2024 13:42:15 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 915638025D for ; Mon, 2 Dec 2024 18:42:15 +0000 (UTC) X-FDA: 82850888148.17.7D23726 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf27.hostedemail.com (Postfix) with ESMTP id 434084000E for ; Mon, 2 Dec 2024 18:41:58 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AJNrUOV4; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.169 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733164925; h=from:from:sender:reply-to: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:in-reply-to:references:references:dkim-signature; bh=zPi/40j9fg7YjPYY/QjOr+/MPbDnr/kKPaDCNQF5gDU=; b=8MjjyWk9j2idfqFumCIyltdqbu1vPC3z/LSaJDl4cZ0ibWnCV114IlXyOvUFmMJGgw8uQ5 dp0O8LuMOrjDAMmWGbajRB0NWyE+NQ3Z5mLw9H5U3eYXRhC1d7nK22MF2Zun+jKv+LPVuN Y3i0g0leESU8OHWh/Np1QhGNtk6NCpk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733164925; a=rsa-sha256; cv=none; b=bpQSrUax7lYx3R1dqP/eIkiQvXmCTxiVSTL/h1EFnI3QUfWDuN1+tcbFPEFaIbuepPEEz/ XIDL0U2Vi1y/MS4qLKjtvq7xgQqMfVhElJKJgaRScD4KxdYgtfr6uMRoXVxi2adyrSfOsg JMbzUBooqZrBwCP2/ztKOsRBeMV3wHg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AJNrUOV4; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.169 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7f43259d220so3013537a12.3 for ; Mon, 02 Dec 2024 10:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733164932; x=1733769732; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=zPi/40j9fg7YjPYY/QjOr+/MPbDnr/kKPaDCNQF5gDU=; b=AJNrUOV4jG2RuM/je6ABxA7uGYSnMM6wdPRNg9BDlSlHikVoEX/0UV1Fs4Pn/CA2hl D2CNZa6wEunLtD3cm1CjbB/SNoIEqxp7vNfTOC6yiE2lIb0BMx/94Bq+nJT68gMUv4kE i8pyBzOQ8EcEnmwl68Dw+Irrir8dlIqi4EvFebxcOSzBE586t6eNxqy2/+y+HNKbREn4 ey349yJ02vJ4kE5YVBsA3eWzA8fUPJYhVeCD9+uLfpOAacUAyy3/JRNoy/7EQSRYxHMr 5KUHobcZqhBdGxH9YxQPhPdktVY0CO44GUFbpyfU+lGwkDSlhKk69+vlAWiLUblTCB3x yHcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733164932; x=1733769732; h=content-transfer-encoding:mime-version:reply-to: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=zPi/40j9fg7YjPYY/QjOr+/MPbDnr/kKPaDCNQF5gDU=; b=Ay3kfqrxbkDOQdrTKAhQnbvLoIFLAI9MFWPUiu1glwdKquuCR4P+YuEBFnp36OLj16 BVeJUlDr4ROgvAaUag2+pmzUBjGY7UVkYnLAGpcqgLd9NExsuuM9hrWzXOtiE1eRLyet RLkPhsX8KW+skxSb8fQBHcFlbvCmCKFaopc0Ng5R6NzqPv5C3QeNW0FitihEW6urMI46 LvwDJi9LR4gTPqOpmWuR/x7dLgg4qb74Y3Ct17W2mBti3caKCFDeU0qgTDgC+XNP6dcM 7N3/UkM/nWZGNTthr4o9phukkPAgY1AmE7MlkiSkAvAJDnIkrL3KF+iX/VP7sREZHwze /psQ== X-Gm-Message-State: AOJu0YzoFV3qD0S8KWM/+lZhZSaxcMKkqlYukrcKYfEPV/v8zSt/91wh L+b8rQel09wFd58kW2If/iriXVI1N48nyu1vzGG6++xsRjTu2JxPJMTBvPW7gBdL5A== X-Gm-Gg: ASbGncsfzT68AqMXHYI84yNBtwVQ/ISE6sLt96k1KwHxL03N5L47vEiX8do4qF38eof GyYJGnrKtiD6+a6noDyD+mtDpsJcNncDytdxwpObiWXBXOmEhFbnOft3xT1ZuaRRp8uJiWGlwf5 Ur+n0GeWTZ6dN/CIpEV/rQUkcH1MWuNKWzLCxwZv7w9FNq1nVg035wrpjRt8JU2Vs3a+W/qkZSC t/Wa1EizDwK5iL+fEMBS55h5Hb2ndWmePr+a9FaTX7/oOEWulMOLxd+2KHPsJ+sacRAFpU= X-Google-Smtp-Source: AGHT+IE35vF16FjRydL5iBcJInocVBicSo1ZjyULb2W4jf/KJQsy63zCROjVa8zaUbfc3UsLb+zrGQ== X-Received: by 2002:a05:6a20:7350:b0:1e0:c378:6f5b with SMTP id adf61e73a8af0-1e0e0b71f30mr31209157637.38.1733164931986; Mon, 02 Dec 2024 10:42:11 -0800 (PST) Received: from KASONG-MC4.tencent.com ([106.37.120.120]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725417fb7d5sm8849781b3a.94.2024.12.02.10.42.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Dec 2024 10:42:11 -0800 (PST) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , Chris Li , Hugh Dickins , "Huang, Ying" , Yosry Ahmed , Roman Gushchin , Shakeel Butt , Johannes Weiner , Barry Song , Michal Hocko , linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH 1/4] mm, memcontrol: avoid duplicated memcg enable check Date: Tue, 3 Dec 2024 02:41:51 +0800 Message-ID: <20241202184154.19321-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241202184154.19321-1-ryncsn@gmail.com> References: <20241202184154.19321-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 434084000E X-Stat-Signature: 45iwekee9da5aa949x6yqgtn1ia9ccp3 X-Rspam-User: X-HE-Tag: 1733164918-711307 X-HE-Meta: U2FsdGVkX18VizJLDbVMKvVGccbrtFwBACG+wC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4Dxp6jlcI3po+9AdM3TiSi0HQ/RwukXm8K7tIeDMtb7I4ryQdIpgtBxVi9QLI8Rq5VpaE651sliXNYMpKSRmuunw2yTFAmceX1cTpHNsiW1bKOEWOKfo2HekLq++VBda4LDyScnHqg3XWuhYCOEivOAn3KgQlESSqTDygcdShNtTfzZYac+ME0HpvCBTDx3u3CzKQCrG8CcSsbOMedHDWSrdXbU+VjOuD1Mz+Ou0BFIQZG/p9kgvkgcv3wl/aXRgxqJaBaB2Hjo/llyhNEc6NpQEEjTRgPHCPOKNNVuRGW4XDHwaaRqJlHU0+EOTwcC9YfatNNeRr2TBFrknr9HsLrzhk0rr0+3z0gmP4nRKrKC313XwkzVDPKWn1SxRAk3OYTEw= 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: From: Kairui Song mem_cgroup_uncharge_swap() implies a mem_cgroup_disabled() check, which is already checked by the caller here. Skip it by calling __mem_cgroup_uncharge_swap() directly. Signed-off-by: Kairui Song Reviewed-by: Yosry Ahmed Acked-by: Shakeel Butt Reviewed-by: Roman Gushchin Reviewed-by: Barry Song Acked-by: Chris Li --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7b3503d12aaf..d3d1eb506eee 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4615,7 +4615,7 @@ void mem_cgroup_swapin_uncharge_swap(swp_entry_t entry, unsigned int nr_pages) * let's not wait for it. The page already received a * memory+swap charge, drop the swap entry duplicate. */ - mem_cgroup_uncharge_swap(entry, nr_pages); + __mem_cgroup_uncharge_swap(entry, nr_pages); } }