From patchwork Wed Dec 18 11:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13913539 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 81A9EE77187 for ; Wed, 18 Dec 2024 11:47:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB32B6B0089; Wed, 18 Dec 2024 06:47:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E62516B008A; Wed, 18 Dec 2024 06:47:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01E76B008C; Wed, 18 Dec 2024 06:47:01 -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 B08B26B0089 for ; Wed, 18 Dec 2024 06:47:01 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3D70BA0DDE for ; Wed, 18 Dec 2024 11:47:01 +0000 (UTC) X-FDA: 82907903064.02.6D490CA Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf22.hostedemail.com (Postfix) with ESMTP id 21DE1C000C for ; Wed, 18 Dec 2024 11:46:25 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fyfEJ3Ot; spf=pass (imf22.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=1734522397; 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=eeisvRurnTC1e6G47P8yM2Vjmq/XPJuXJ3+Yah28bCaobs9hM9UepgjMreLfPOTckkBPtx dogDnUSbmmlIb5NfRUy6nflTxWIj3O5FeNw/mrqOPHRua9k+TeDuvJKNyDHCshOyD6hNc2 /+h60tQ8NWvFNXhuZcsdgwiFd/FiRaQ= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fyfEJ3Ot; spf=pass (imf22.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734522397; a=rsa-sha256; cv=none; b=2ac2+0bHF4eGHam2gPS5e605UDM+yT8F9gxlig7t49bJ57bEWU4qxHt+T/agOEPbvWcG2t /q84pPhsKD5fLHCrPSOu+e/mND+xnnbsBE2FFMUwldXY7n2Qz4s2Wd+e7Pd+ED8JUabguo XXPGWa1E8LRRXdKfRYA/ulkzO/p/Hkk= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2163bd70069so64637715ad.0 for ; Wed, 18 Dec 2024 03:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734522418; x=1735127218; 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=fyfEJ3OtllSvlF0fDQKlVpSdjTIuid6Ahn5jPAP3sD3P00JGT5Eei5AaN2Z3/60Oey if1DoS6/+CzEqd/Iq4guIAPxrNkk5ajqqMbOLQ2iIcDozra/3o/edgAqEPyRZdjbvVmC 9ZbJsdpA1A4IvNoQocbuqFxgTTOyHQa4kOLgnUKd/bU7QzMcx7KVZAk1y2U1EkojokTn kpmQiiC3C/wtqMMZRMaw7tLm5MQk0ydQA9akznqg+PhLlkmliANokMZWg7/EYfnHPQAN dXS1oyQP9nHtEWf8Em4VNpt5V30EKk4vXT+E4UToYfcrYw9DGS44zov/XCsVXyVhXKEc Yl2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734522418; x=1735127218; 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=juWiLaoo5qkmnwyON9hFNgqQx72Gk4CBJd0U6D1EoOxvHQmL9FFxdO4YyEwR78NG0X EjaPYgSBKiV3h6Chm1QN16JbLOWQCX+P/oHjxKMrGMVHE4pXrgGBXRKGa+fTKKx966xb x5DBKHuoA8T7NOKxzWdsALdv5k/hjwpTlIjVfgnUPHNc2RArJ/2Zt32uPqgmbI4R2oXP DrT96CyZSJeZDh+vBaVOEV9Zew9Mn5XzHrJUzJNTGWM+wy5CWMDyi1Pz8Cazxz8zEHpi h7DG2ocx+tBBbvZ/cu+wzK9K/wS5mM+kOpIgfPoSUhs65R6Ghe+X039T/PknjL63DMhR 8brw== X-Gm-Message-State: AOJu0YznXxyNEaw10CH68dTE0BjLGt3KCFxS5ZglfgWdNJ/2jhL6MfxE l4R2vfEZLy1WLxOr0kjHwWMc4rzlZIzBSyH1yYy19vM5HxrC6c0459Bdpf9S X-Gm-Gg: ASbGnctd9Z8/wOlCg+gEdUdOwugVSJ5GVjvMChOgOppxxEPoesqBcDO03grZWZsErcz AaCLIfgNsANr9NcpTRWjOcPQnTKHWSiXhseSdNrX+g1/FQrwP13UxLsdA7emivqPbWHPiQHNihp AyLAT/BFqNYkedEGJsXdKFs8I8RrXWScPNGqHt8fvDXPKVCdJV/G9frnKcAkrBOcgLeiQutgLll qHieD4k7yzXnDTNGDJxgpQTlqft/dFZ1e1L9pSfbzKHQtv1YAPNCOhHaEkx8yKoSmAhN4UHmF/p FdqcHhu3SuI= X-Google-Smtp-Source: AGHT+IFDiEO8Z+4jJiOJGyVQCnx8m44fCY5Sa4Cm3pyPpkeXJ0qEbZhG2rc7F1TYGzL+U0+D2iRi5w== X-Received: by 2002:a17:90b:2745:b0:2ee:8ea0:6b9c with SMTP id 98e67ed59e1d1-2f2e91d7dddmr4670423a91.12.1734522417699; Wed, 18 Dec 2024 03:46:57 -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.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 03:46:57 -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 2/4] mm/swap_cgroup: remove swap_cgroup_cmpxchg Date: Wed, 18 Dec 2024 19:46:31 +0800 Message-ID: <20241218114633.85196-3-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-Server: rspam05 X-Stat-Signature: 8xxsjoc6cfy36nfnai3eno4du7hd1i4p X-Rspamd-Queue-Id: 21DE1C000C X-Rspam-User: X-HE-Tag: 1734522385-584801 X-HE-Meta: U2F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r98kUtbUJ2mfrq1aHb36jvKOPX/i6XBqw4TjV3uOdUr7j/P/VrpjvgZvU0UM4Vsd3/DEPxLpMDyMoaBcv3ht4ZypwUUAQfFA3IjkBR7ceZZJCugxnre56QFyxXv7A+vbUtSL9SXGHAf0nE1EvpU4Q8q7onDRMTRnAlis4Hrb3fvo0n+GYDHQFIZGuHdsgkIHcH4HdmxgUwZAbt6O5vcRq3CzQFC2jAe0mtQwwspKXUG9a/PZDSUmeBomG0iAet/bxLGPfRixwvntkfajg+edSgTLz1FbsaHgZkYIYx8YK0L3tE973ZP+Epi4jz4fC/N5j/VYqeajYODrFD2wEPrkiP20aLduN4CxrsccjSnW96tDpW8Ek3JRCcdOKNKvlmOzIEEqMvrx2ngnZO/ALbA+IPVkUhDb38IBCsGX9Ty1dUEVjhZuSVOIToLg6QuKerhzeqjV6URsVFsJsWlHqCfZPTGbFVhSFFPmbLw1+SYoc5muRYhMXPW63JFbNHaDlWaxlTw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000043, 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