From patchwork Tue Dec 10 09:28:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13901073 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 6EABDE7717F for ; Tue, 10 Dec 2024 09:29:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDA6F6B014F; Tue, 10 Dec 2024 04:29:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D5F4B6B0151; Tue, 10 Dec 2024 04:29:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB17C6B0152; Tue, 10 Dec 2024 04:29:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 947076B014F for ; Tue, 10 Dec 2024 04:29:06 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3A4F71604A3 for ; Tue, 10 Dec 2024 09:29:06 +0000 (UTC) X-FDA: 82878525072.16.A3B9664 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 002F31C0002 for ; Tue, 10 Dec 2024 09:28:22 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="DdCU/Dul"; spf=pass (imf21.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.177 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=1733822934; 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=XXPbw4CmFZlsHQ1dqNkun8nNSKspNNgSNNzQzzqG5eQ=; b=CE/r4JCQVVcSwmpAR3Flx9fwSVatYnxSOpof1SCF3qjjdNB7GIlB6dzaPKKC0ICmQykYP/ IZm9Ml1FNTkRxr3O3GG50n/6PRQoe5+WnNZjBCy/x9/CA0NeF44/PuWOxFn6eGbwJqQg6L InCSCsipiZ5CK+BAxEIUvc/tCOVUOew= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="DdCU/Dul"; spf=pass (imf21.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733822934; a=rsa-sha256; cv=none; b=mT0wDXre6IZXYPVV45ios0RaeOXQ8F9SoZjq2eBll8KypbPqOs1f939jN5QN2vyX9jh4u8 VRzdEWTvBLS3vdOfDszksvhXCRb099FXbFAOi9OugcO9+inyGkjGli8QVOShYzmj81eZ18 G/n8m0SBgEsP2e9F6+ZwAea4j9PGmTQ= Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7fc99fc2b16so3946242a12.3 for ; Tue, 10 Dec 2024 01:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733822942; x=1734427742; 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=XXPbw4CmFZlsHQ1dqNkun8nNSKspNNgSNNzQzzqG5eQ=; b=DdCU/DulNyDZSdvdhm2h+2WZ7AsLW4H8ZDaWo05UvhVCmIBSZWRU3BEY5c9HhaU0HR jzthYjWwTKh8FW4WKR0osW7wxEeNojWM1WPaJBbobmXsOcyEIDTeyI1jVyK1aHJRXf++ 3nS8N9JFH0s21/u5lteo1jVIDnVHFGNwgMF8XGy48tTiWQiAyY5EK0k0YrPDXYmVX24x S3H7dTWfEZb60vgjOIVPyhfsZtQjbg9B6ks2/Wb6Nda6YfLYrRCcpiPcRBBdctxZ/ZRA 8FqZHsLn2VLUrotx0J/KJWdfTxX2HGbp/Be1zEDhhi6J7zCM+FLzMPuH9X2nIUG6i8FR q+Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822942; x=1734427742; 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=XXPbw4CmFZlsHQ1dqNkun8nNSKspNNgSNNzQzzqG5eQ=; b=vohyydijEmfnimIZqtxJYwCGawiGNrKcRdOlrctj4jTwG//7mn42wkXrJTzzaVNhzi X8BMienQ5V1occkDZkWd2w/y/DiAOvYvstKu2ZjXdHmUbZAwH4UemsqdrzshlriKX/rI SvNawEFlTLc1gVc9bhgeW3rYIGTZ5uQTy2QPZmdzXiv9+xj2DxfayFYiUyInhSttI7AG WdnH7hZnskQnyajODZaPNiTO9iJl4cuvbvHKjWddmkmX22m7gzKQsXCk94pQ7E0pI/XF Yq9lhg4XHc3jsZFRjdXoiu3cA3/cKASJxaWtsycSRwb+z84ZYyS38InrV2M0b2h27NtV oA6g== X-Gm-Message-State: AOJu0YwA9As8oBal2ZRrw3ltS8I2Ruz74K/ts5ljPnnJFxs8o46K5rbc RILv0sm5REC08uz9olyE7/sbC66Z0q2J3irGXXGe1/SGIiLPGlvAndce9DeOi+Y= X-Gm-Gg: ASbGncsm2GFJQiwSYrNmiyP+xotJ2+voh0gEQbLlpHBIGK8BGCkOzw1arpGTDqgF1pa 5wskZmu064VgFJUoTzbWXMMucBl9QGJP2JuJiDxfz6q7GFa2jYMqWzX2hZubCuyOQy4F0/uH2Vd jpFuw4FUywbCC25uNhVns+NCUCFRM29y7ge7UDqOdgWJAWFLmatQ2jRvYt3aMX54iY/vv385ACg SLxzGGAQMY74sdlkvnWza+doh037uYp2I6ZaNnPuEnsLM1LXpqEFa2YFARzys2k96B8IUtRl3D6 3AELXW1u X-Google-Smtp-Source: AGHT+IHMU7qNZnjZ/bkeJFqL1owhrOCa0EJiXmL8JTWuT/MSJlktqTs5oyZfJOCFQItybeRNzpjntg== X-Received: by 2002:a17:90b:5184:b0:2ea:4c8d:c7a2 with SMTP id 98e67ed59e1d1-2ef6ab0d5b6mr24092612a91.24.1733822942554; Tue, 10 Dec 2024 01:29:02 -0800 (PST) Received: from KASONG-MC4.tencent.com ([43.132.141.21]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7fd1568f26asm8750095a12.9.2024.12.10.01.28.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Dec 2024 01:29:01 -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 v2 1/3] mm, memcontrol: avoid duplicated memcg enable check Date: Tue, 10 Dec 2024 17:28:03 +0800 Message-ID: <20241210092805.87281-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241210092805.87281-1-ryncsn@gmail.com> References: <20241210092805.87281-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: 002F31C0002 X-Stat-Signature: uhpo7q4oy8iekdc1uzuh8rt4w8ff5uzd X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1733822902-4785 X-HE-Meta: U2FsdGVkX18cI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WnGY/0kGBZz+WD4DucrpJ/0JZK5iyjathsAn7ekgzxGOziSwNFtYGISsAyB3tSLX7x3C7a5avTteyqkA5VXdxeWXhKy08Vryz+vBCd1JkVtZgQh1sgXuYqx04Wgj4yEpr1+lL1wAI29DkpYMZxTQX/JD3bqTBgzdtMz5ZvkVjczanYW5t2JZ7Uxts50DayeRSXD0ePT7Ff5s7s4pfgJ6ATfOb1A5GLPrepqzizUSZaRhGPFkGm5qbV+WxkAPhDaeFNqmChBHvT6nplY8JGk7mSkYD52w3jSiLiWUdt+wBTBT8H9k2cawgi3s4/hRYvpoNo90pJMYPh4pcio/hTDrzDGLgq/jwGvsC1wEJX2E8CyUMsis65aYcb3lbrznn2InMH/LMPpHiIAk8Sl7T+W0VU9CbBfgGT55/TnKX43QfbTkj5geNealyiOWs2EL9kRASTRb+ApjaqwwOA6fjBLcAYU3YYuYGr6IKnS X-Bogosity: Ham, tests=bogofilter, spamicity=0.380458, 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() includes a mem_cgroup_disabled() check, so the caller doesn't need to check that. Signed-off-by: Kairui Song Reviewed-by: Yosry Ahmed Reviewed-by: Roman Gushchin Acked-by: Shakeel Butt 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..79900a486ed1 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4609,7 +4609,7 @@ void mem_cgroup_swapin_uncharge_swap(swp_entry_t entry, unsigned int nr_pages) * correspond 1:1 to page and swap slot lifetimes: we charge the * page to memory here, and uncharge swap when the slot is freed. */ - if (!mem_cgroup_disabled() && do_memsw_account()) { + if (do_memsw_account()) { /* * The swap entry might not get freed for a long time, * let's not wait for it. The page already received a