From patchwork Mon Dec 2 18:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13891175 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 A48ECE69E81 for ; Mon, 2 Dec 2024 18:42:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30DE86B0093; Mon, 2 Dec 2024 13:42:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BD376B0095; Mon, 2 Dec 2024 13:42:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 139E96B0096; Mon, 2 Dec 2024 13:42:20 -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 E40E06B0093 for ; Mon, 2 Dec 2024 13:42:19 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A99A1A0201 for ; Mon, 2 Dec 2024 18:42:19 +0000 (UTC) X-FDA: 82850888946.18.15659F2 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 69D5440012 for ; Mon, 2 Dec 2024 18:42:08 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NZWB4nLO; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.174 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=1733164928; 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=bgfYlxq8M7pj/EQVq83uOmq930B/5yWrzKvSMuqYhjs=; b=4jpbsab+drBjZx5RPzXMEAp/4iarhDy89E+6n85M8ntZZ97H1NeN6pPNbsV7IMwM1KH5hB o4p0PiZbOBHy75Qbm6YtAhRp+DS875W/WWhwytb9SBpi5hOacOAb+Sstq01zXon0UiKexO AjNCO0hZTwPPXx3XO6sKnIOvV8QGIoo= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NZWB4nLO; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.174 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=1733164928; a=rsa-sha256; cv=none; b=cdckfXGz8AASn9hBxml6j8K/ToM6RCASu8CvbdelsxCYwM5ITSCxWktVKvz4jL1ADqLPtG Wvcauxqg24FaH+ny9jTfwulabmDDcFoBX4OeBstCd2EMET86siy7H0J6p9J1Ig6PvUUrS/ 1es2ZL1ngOjDUwoSven3VSYdVV8a55c= Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-724ffe64923so4809263b3a.2 for ; Mon, 02 Dec 2024 10:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733164936; x=1733769736; 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=bgfYlxq8M7pj/EQVq83uOmq930B/5yWrzKvSMuqYhjs=; b=NZWB4nLOzshbcOODb1uXvncniQWsLpLdU7VGyTaVv9zInozOsok4RFVchwXWPOdwuF 37Zjt8Eoy0RYeNkioarvCh9GFuOmmI5PXX49zvWGbvW59bMZ/eIGpMdvrMhhyZJ54eWo H1YvvhrlHdR1Ag0xuYhg33FOBEMXWNJVB/ndcvppXKR0IyiqpsZ/vQJ2PZzaxWSGbmdc TCzI5TQQ7BBQJ7tVIOGg2obsbB8YPDdBhT8mXDOppu+2U65GiLSA7gH9Gpf8g+xH0+DB K8/4T5UKygalHgI7Yms/Pdl56wRXzl6vcnTChYKJZ6PLUS5wmaqZGE1gMU7LQmwC9QiA Fnew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733164936; x=1733769736; 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=bgfYlxq8M7pj/EQVq83uOmq930B/5yWrzKvSMuqYhjs=; b=qYY7SYhSDp4Wf2TW4446I3aB0kxjA2PV++MGhhSs81BCI7rsxTqD4KU/r1m9nbixT1 0PKeX65MTSj3DWR++wmfB2UFGLKckuVBlm5yCtiUJ8xVrjbY5iXTMuzp3LLMudVv5Uvq cG/YauqvkeIEJcIs1ggqJm6Sn+u2Uyu51gVVLGBTOfhoah9YrnxC4yXWL3i/NWOHzm1F u7tPST7p8i0XU+EEgf4/WMpe5WQsojkJkHSgNw3+U6P2l/YAQn09h34jl5ZXo0iwSHUm G1Z1MRAnuNUnfwVH3a3WW9/F0g5/+LxyFjPOFKlG+zebzQ0seAnA+aAPvZasTj1mUrsm mHJg== X-Gm-Message-State: AOJu0YwQR0dqvda5QgDCCai4RwGE5GRAY/V+tumgGcfccMpYKPy4MVNV o8Cr3SHWuBjHC8yoORlqeHfCb0eP5cyku0YgriTpXHYjGJeQXNNrWa1zmxSf2TpFhw== X-Gm-Gg: ASbGncuGGXfMsoLUngyF3aU5xSlb8KlxKBGxPep+PjxI6zUI9rQPwk8f0ZxnmC457FH sqJ4gwyLay8ELBb3/avJAdzyNo4thtOCOytnLHnfSagD2czRACtm56WX2/meXXn7WTqbk9uCRD2 8sYThH0Rhh+C6gMpyIUZgzbfm3Hhyce2s+M+65KM/AH1/XQTi9WvPpuOICev5EhdhmTUfExAwwr 9cMeMf4watH88LNH2JzFqn2MlPG39Zg081QFK0kme1fPY0zJPj7E7MRAN2w+0Rc7GsAoEc= X-Google-Smtp-Source: AGHT+IEeppgHPbYXo/4IKwmclLHEdajSYeynVAjocWeV2X5vj8HNw3SKD3ti5afx7GbXPWkD1M5KNQ== X-Received: by 2002:a05:6a00:1c8d:b0:725:3bd4:9b56 with SMTP id d2e1a72fcca58-7253bd49c85mr31675949b3a.5.1733164936073; Mon, 02 Dec 2024 10:42:16 -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.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 02 Dec 2024 10:42:15 -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 2/4] mm/swap_cgroup: remove swap_cgroup_cmpxchg Date: Tue, 3 Dec 2024 02:41:52 +0800 Message-ID: <20241202184154.19321-3-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-Queue-Id: 69D5440012 X-Rspamd-Server: rspam12 X-Stat-Signature: e5n6crw8c6rd74fme3h14hb754sedawc X-Rspam-User: X-HE-Tag: 1733164928-606878 X-HE-Meta: U2FsdGVkX19o+1SGT3n7eH2Z9nP3EmhzWGw1hJDV1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E7+75zZqJQuDcDdpVtU8PAK/IYJkG3zxUwG9V0hvT1u4zBO61DG3phf9BfKGJtKTGc3KPSOr4755FEnNp7ZyJQof1yIM98uk5NOr+XfvmJ9SKLpBCPJbzAUlsBMKLhFJIpR4v78fkyuULRc4hW4Cxl3vZJaNa7CTuTTjfCHfovYoZ2eo3eLYX1ZD6YgbBT0QXgqp1+2qG61C4pcdY1RJdWB7R1ug3ucJIHUU8LNXbLaADOUT0bv/UaykQcGcHChQjTodVRNegj6Src8qituSphQEncoKqACYgP50IdLfKP3fq6FD2J5zejJrZdnyxsNb9Vo/ELRfCRiX7iaSt/AVMGGS0BjssHDrVHPF5c04QFDDd/s0fJUCyy+2/4yMfVM+yKwZ1504+HAdJz4/nolq6bfxfwbagCERDN8BPBLUb6aD4AlDiWCl0m4W2lCQlQw 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 This function is never used after commit 6b611388b626 ("memcg-v1: remove charge move code"). Signed-off-by: Kairui Song Reviewed-by: Yosry Ahmed Acked-by: Shakeel Butt Reviewed-by: Roman Gushchin 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