From patchwork Tue Dec 10 09:28:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13901074 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 8544DE7717F for ; Tue, 10 Dec 2024 09:29:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01B076B0151; Tue, 10 Dec 2024 04:29:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE53B6B0153; Tue, 10 Dec 2024 04:29:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D60256B0154; Tue, 10 Dec 2024 04:29:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AB8116B0151 for ; Tue, 10 Dec 2024 04:29:10 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 193CBA06A2 for ; Tue, 10 Dec 2024 09:29:10 +0000 (UTC) X-FDA: 82878524652.03.BF6A63F Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf11.hostedemail.com (Postfix) with ESMTP id 5818440016 for ; Tue, 10 Dec 2024 09:28:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LW2t0fPs; spf=pass (imf11.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.179 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=1733822927; a=rsa-sha256; cv=none; b=46HB7rQKvfOavQoaqyiCQGAIadN/2petXpcWAdkn0yCWM65drQ7/p0pSJC6pu8mxbUe7+J LayZZ5uic7UARoobCiBHuHCBPZOlVK//tuPJX30O/XnyFy1wN4aW062SUZrwolfb2fwJ+P DdBKyd4876fOh8q6QMQd39+A/B20L68= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LW2t0fPs; spf=pass (imf11.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.179 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=1733822927; 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=BSCLGHYqLWfZbOCM52YJejtZzzMrW+w4kb+fWMx8dAg=; b=FkdlwdaID2dBKccdVr4aOvXZO6mM0YYiYW2P2cHgdJkyFDZAPB1UYhGgJzs5Rixb/MULPd DpWv1G03WemjEEWpEkqxvjYrb/DiGaNrbKNO6H+16ALKWqRSWfSN4shiUdcMI1mRx8baJ/ BKVKKi5eYWYovu4ihWKLoFfgqrIp8RY= Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-725ef0397aeso1658588b3a.2 for ; Tue, 10 Dec 2024 01:29:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733822946; x=1734427746; 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=BSCLGHYqLWfZbOCM52YJejtZzzMrW+w4kb+fWMx8dAg=; b=LW2t0fPsVtIGBjeAaaSnnp3aqRmGtVbbif0A5sx0sIR8Knf8cypKtFVOmf3N9BNV2g SSujuWgqg94lAH5tRuChQxb15zIS0O/e71lYcyJCRW/zKPVF/xStgavac6Dizdd5II0P SzHlbf/dAZaGXX7lbMZeK/j8nRwDl1wLGkwZLQX93QNu9ybpnMJZqVxikLvqdO5lgsaB DZbazysTZ7/iOXJhTa8fTGeWNHhyn540MdAYIrktHzjLgmuntqAVJ5DSUfXk5xKhAyBo aXeYjO/8zkKfF6PzOkvivDiIqSP7zqLGVymhqrfih2i1CMaRRk6fxDpkf9ChMcEb9TIC jPvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733822946; x=1734427746; 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=BSCLGHYqLWfZbOCM52YJejtZzzMrW+w4kb+fWMx8dAg=; b=OMZElTcFJ+/v292JKIhpqvURBqBN8N4IetbLygO/1fgJrp9iFf6UG4RCc6w54anpsb Lh9gOvQ1x+5YhzCoVZ7a+pbP6iFyHcoycu1O2QdhtTxU8Z/YVkXkZp/qTMNRnddvzFJb wj7PjemwFDw8NOrHbBs3kW3tjaFZ16sX3JE0aR38nxL7Kred8AZkYwsqYG/4TslDw6WW Bjj42IcsfCyQiZ5jQIGbS5oHPatc5ws2DRUr3THaDlJjS8AAecI3D7ZxP+Nb/qJWPs2T Kg0ScFS7Ei9o3a3sv5PRm3s8vFk4YDIJ1KoZpJz7G67qcLjqNm9i9Jt1vGsfBa5XPKrq /qrw== X-Gm-Message-State: AOJu0YwEAuwO5RU1qu9uDgaUb5Y1Diz11FUycGGXgGvXo6ja7/Vzo52Y yXU5LEHN0ZP23mh6N7/ugdpSHxrPv6Ete5t/gT+NDNx157hn/NTjsrtvX+Flk+M= X-Gm-Gg: ASbGncvJJbM/c44DFrrNOH3NNaUxkW/d5P9dDLbJlojiTqwPAxmuYRvTuofCFm0Yat3 OFp6YcYaQr5/MXoA5k49PuGpnoK5FQG+jhSu+ouK4oVE9D7YpxjVO4TegVVy0zKKsSiKiURMI59 mRlYbuG17qq2tuBKrE0lJfss9ydrNPO/8iSN7t+ZMODqSLMIgd41tzT8ZND83j7c8n+KH7wYTqi rdp4QT9IJ9n5JF6yTweFEl1nC7rRvo5GzlJPLVJSo0ZB7CoTfJ93VHzCO5TwpKtA9yQGkjwinAI RYas+hGc X-Google-Smtp-Source: AGHT+IHV3lqRAPpmlMOBZuYBAiL3Q5xtUsfeTC5YD+b1WYrzaAKgKUOsPSV0U0jw1or5OftGfUdPEw== X-Received: by 2002:a05:6a21:78c:b0:1db:ed8a:a607 with SMTP id adf61e73a8af0-1e1870bd7a6mr23599578637.11.1733822946475; Tue, 10 Dec 2024 01:29:06 -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.29.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Dec 2024 01:29:05 -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 2/3] mm/swap_cgroup: remove swap_cgroup_cmpxchg Date: Tue, 10 Dec 2024 17:28:04 +0800 Message-ID: <20241210092805.87281-3-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: 5818440016 X-Stat-Signature: opmwjhmb7w7rwecteondejcgndhswrb6 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1733822928-548424 X-HE-Meta: U2FsdGVkX1/iwCQ4xMRbM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8GgnFrMDT4T0cwBxI0sTKAJa/0ca8ENioMNYiR7wbT43wwkqIzbmlpdqdlZyeXi85N0My95+bLcgkH9tsu8keWkYiwYnKQAB4QWOQvDVmuGRYdGaager4YgM8yUUPEIfyavtgf+NKr0Wvx1R9A6Bi6/OD0l4UFfp4R0clhDRAl4medxv39b+2q6vd/bY1zF6xQurt6VknAEMBP5tZazdJ1Xhi4rqDrbTiuWezSRYT/fcAqO7hAPNZTqoUjibIpD0GqMZqQJ/0GrjxD8kfRUAC4Mgp4cHkOKOj0aSsr6I0QFv3Whp/uJ/byzHVgdsx2HPFC6kLnzUS1iqRXGEjuK/DIbaq9/JHA4Bdf3WvHUx5/+srJ1M0KOgMHfa5R8K58VtxdS0T5zifY5LV/DGuqV1xIhsKyxqJp4hHfAXIjDYlzo2/w1S4PMuqOqvBJFXDOluXeSaTwdhLJGCVBK3iwUH1nrxIcSDOzGnLFdajnz5Lhxd54yyEzDMIGjQUXA/L7WPYc3K2jYOEtcGit2dLlkk5pOXRoA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000143, 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 This function is never used after commit 6b611388b626 ("memcg-v1: remove charge move code"). Signed-off-by: Kairui Song Reviewed-by: Yosry Ahmed Reviewed-by: Roman Gushchin Acked-by: Shakeel Butt Acked-by: Chris Li --- include/linux/swap_cgroup.h | 2 -- mm/swap_cgroup.c | 29 ----------------------------- 2 files changed, 31 deletions(-) diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h index ae73a87775b3..d521ad1c4164 100644 --- a/include/linux/swap_cgroup.h +++ b/include/linux/swap_cgroup.h @@ -6,8 +6,6 @@ #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP) -extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, - unsigned short old, unsigned short new); extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id, unsigned int nr_ents); extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c index f63d1aa072a1..1770b076f6b7 100644 --- a/mm/swap_cgroup.c +++ b/mm/swap_cgroup.c @@ -45,35 +45,6 @@ static struct swap_cgroup *lookup_swap_cgroup(swp_entry_t ent, return &ctrl->map[offset]; } -/** - * swap_cgroup_cmpxchg - cmpxchg mem_cgroup's id for this swp_entry. - * @ent: swap entry to be cmpxchged - * @old: old id - * @new: new id - * - * Returns old id at success, 0 at failure. - * (There is no mem_cgroup using 0 as its id) - */ -unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, - unsigned short old, unsigned short new) -{ - struct swap_cgroup_ctrl *ctrl; - struct swap_cgroup *sc; - unsigned long flags; - unsigned short retval; - - sc = lookup_swap_cgroup(ent, &ctrl); - - spin_lock_irqsave(&ctrl->lock, flags); - retval = sc->id; - if (retval == old) - sc->id = new; - else - retval = 0; - spin_unlock_irqrestore(&ctrl->lock, flags); - return retval; -} - /** * swap_cgroup_record - record mem_cgroup for a set of swap entries * @ent: the first swap entry to be recorded into