From patchwork Wed Dec 18 11:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13913538 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 DBA3CE77187 for ; Wed, 18 Dec 2024 11:46:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 564406B0085; Wed, 18 Dec 2024 06:46:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C62E6B0088; Wed, 18 Dec 2024 06:46:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 365B76B0089; Wed, 18 Dec 2024 06:46:58 -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 16E6A6B0085 for ; Wed, 18 Dec 2024 06:46:58 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 962AD160DA0 for ; Wed, 18 Dec 2024 11:46:57 +0000 (UTC) X-FDA: 82907902560.05.6FF8B1C Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf19.hostedemail.com (Postfix) with ESMTP id 6A5261A0008 for ; Wed, 18 Dec 2024 11:46:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=itdR5Yyh; spf=pass (imf19.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.180 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=1734522380; 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=zB/9/j75C7gtlrfSKG5BAEz8VhBMIsLT15wOZh2+7i3vyWgCR6T/gM5hOU9YTW/03avHbk IiD6GJqxjASS6Nu90zEXyrlmae7b75e7kRQnhLD7QEuynzHvo66A4H+R8pRFhQtnW82MS8 semCygJf2fGEdiZB7tXG4hLTg9vN/uQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734522380; a=rsa-sha256; cv=none; b=C/nwbko06Ab6nDU4NJys8l6HWrAfB/aeT9Qn+rcts2bho8W6SDehrip7rfwel2HorSWKI2 Ec9+6Gj+/3LeOYkzYWRTIOhAvoMkLqNpQ43AJZEngQ1pnZW1krT/JCRcq+/EIjL47l+qZI vjG8lACDTQvQ39mac9M7FmK8CAXxP4Y= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=itdR5Yyh; spf=pass (imf19.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2166022c5caso50861105ad.2 for ; Wed, 18 Dec 2024 03:46:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734522414; x=1735127214; 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=itdR5Yyhj+h/+WEqWv687WKCIImxlKpR0HdX2lhhTjtOiZxvW01fWCohTRrtgRFClL YTWlgZji4B9Yx9H0jeFohFfY3cTJdMgiOLcMODEbNO3zIZKpsl61bzEpnjiuv+3nEwAY LKFjxVl0lv+If2PyC5BOV2Qoki/9G2mtkZepYrcnIKn6x5NvCcfImtDCF/JLhL9uBO+J oRhzlZMEYpiC3nr27L8JgwZUBp/OwsZ75EEuRYFOexJCQLJP6s96U8ygxBnihbHQjqz+ 6c+ZQaoI6FLk9IzfNzDOq/AW84RWXas9K+SXWYTFJT5oymwCH4jw1VVDhgl7lCPmIGSY t3LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522414; x=1735127214; 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=YrEVKfGPawjDY8m/GcdbrvOuUY29UJiQbreGHKwZ7b88nvBIlQIIX20HDLruAxcS9x MyQ0JAK3vdp5SOGY0I8AVCqfrZ0XmlLlvlFqOwVjyi8/pZYNKDT2UOX5pVEhST+IZIDm Bk/v7oXd95kH999Mdi1FTWnBvwEA+lnaCxdnOSmxij1TCR85nHFjaWMUSYwE6skssDnh lCymSUV1dE/8gnQJEQjwulTZFVKkQrouYl+2B3sOTcIEg7uJjMGqR/g0I7/qNaKucFS3 F9Zdv7Gosnq4P/QSWS5x318al1TiFvItoAqRapfCtsce1QslCMQB2aduaH1VmhRed6Ei mhYA== X-Gm-Message-State: AOJu0YwnyAnbTEx+ZMms0mqZJrN3dOKqy0aXrtZhHys991AI5lnMlVei IPPcBYT2SYTo0OVTvQJpb104NlYaSrxCSWth054WPW552cfp8kDK12Nhz/gn X-Gm-Gg: ASbGncsy0dnfC3b+hxCv7JZExA45/M5g20bZm1ARWAZffZdPYyAmR/pZjRVFAgTwt61 e4f1QTUDTM3QgnKLgObyP7OvQaXABmscIeAK4L+FsVI9+AB5/7WoQAZAL3kBHdIRH/2uD+HB6ZM mz2HE3e/57C+6tgQlhuGSlnprVGURbO5a8gGepln+bwGa9KSC+Sl4YzZC6BTOh5NKUhdagdcTNq FjiVD6Ej4hnjVkIekGCvAo1/dSN0W2FSDkcad6m4lbY/7l0miBt2qIs7QI51wWwZ9rKYT/IqVaj 5Huses+4GQE= X-Google-Smtp-Source: AGHT+IHeEFfNZXB8eHhDobzJ6aD+/g4JcIAsmjLr3dsquieQlQtdJw7HvtuvZYuwp308/geLA7elvA== X-Received: by 2002:a17:903:2348:b0:215:9642:4d6d with SMTP id d9443c01a7336-218d6fe1d79mr29573335ad.17.1734522414061; Wed, 18 Dec 2024 03:46:54 -0800 (PST) Received: from KASONG-MC4.tencent.com ([43.132.141.21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1db7f50sm74337285ad.39.2024.12.18.03.46.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 03:46:53 -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 v3 1/4] mm, memcontrol: avoid duplicated memcg enable check Date: Wed, 18 Dec 2024 19:46:30 +0800 Message-ID: <20241218114633.85196-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241218114633.85196-1-ryncsn@gmail.com> References: <20241218114633.85196-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: 6A5261A0008 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: smhmjskbyj3qwoos1usjpequ64zhcfe5 X-HE-Tag: 1734522382-886645 X-HE-Meta: U2FsdGVkX1/2Qb/LhrIIAa1m2suT/xF44zdgy7N3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G8PKRcLD7gaIatjnWHiFbY+xa4vFG1Q/sryDCp9Z3W+CHZ7CeNQYljTrGkZs56hwcqznkoM4R3Ag+yO4LRF+6mb5r265yZPBJbkUtexOaXnBAjVFnwves9X28+jY08vxLYcvV+0YGmBmV9hYKXs9iNbAT0ITfESsgmY1yWQ1aBOPVn/BKDTpSZJsvpzMrgY9Qy7a+dgGXyvxjYnemvm83HTNfljhknx+XXQrmQW21I7Uu9NbeW5B6nzZet4NfDxhrccs5bfCo36kF8ozzLhFq9cAZ/pPQjblEMn8V3/zlz48w//0VyR9wYfBeMHHrPvw2hAY0fuf0yQCKAtaCYFrKW+9FSkUQqGJ5o78Hug8caTdJTVBFaD6vG+fUhN0FwlZK8D36WP/ca/i8+AqRMPjgTEvH1Wt1Ugsev0FJffKY9F0YnwasMUbrQBVIO5kyWt1EaQadswMxK21qSvsn+U9vEHlZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.038348, 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