From patchwork Fri Oct 14 11:43:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13006931 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 A3DCAC4332F for ; Fri, 14 Oct 2022 11:43:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E2616B0072; Fri, 14 Oct 2022 07:43:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 991A16B0075; Fri, 14 Oct 2022 07:43:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 831306B0078; Fri, 14 Oct 2022 07:43:50 -0400 (EDT) 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 6F21F6B0072 for ; Fri, 14 Oct 2022 07:43:50 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3ABA2A0BCA for ; Fri, 14 Oct 2022 11:43:50 +0000 (UTC) X-FDA: 80019370620.29.5D615EE Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf03.hostedemail.com (Postfix) with ESMTP id DE45D20027 for ; Fri, 14 Oct 2022 11:43:49 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id gf8so4679734pjb.5 for ; Fri, 14 Oct 2022 04:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XtwckXY6GxG78kcpO8+3k1Gq+VT6rNZTsbhQDdeEaDs=; b=RyFNLKV4kCKAULz2zXwQH1I7Vbb+R8O/w1860da086cFUgLzEPfQAZHXTJ7s8Y7ADQ jfEuo6v3iUa08i0aj9Eu3Ql3MEyY07KlN3EK79rrRZd72kTZ3KZOTBI4oAuI8Q7aooBY WWxhsTC+tg5Psc09DFqaQCLWkEAN+ZwAEN1gOCLT9x+h6W1Ylg4/2DbCCU3DciOzyJTx 46vVNqE+sV20n/trrqY+2XDvcIA3+Ht+Lz8RWq2s7bmZqNBlIEyS7m0iR4gQTbrlsaVq E1k1lzwK7hw/kytwHvz0v6V9gC8nMoX1qR1bfYcsnp7Kv/W9w+xRV6s1gr6YVPWqTbKQ ChUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XtwckXY6GxG78kcpO8+3k1Gq+VT6rNZTsbhQDdeEaDs=; b=qu/4M96EYeQ02Sttq/3QfwDaXMQIspBFzCKrQIyG15XcB8YOxjtHLWk4A/Fzig4pvQ 6lAuNl7LdXD8QTcl1Ow+3LiYLw+x9SnXAwczqdZHPbuvgAAtgL6OxiJW8qRuevj5oEHw lL0kagA4DB9wncA3PTG1wtKToqQQy9o0DQQsUf56zf0fEIgYr/0OI0ZmRXDRDCDPnMXH M62vn+KvZaf3YB/f6cXHW5FV2KV6vHq96FgwpdwIzXShPxi0JqcxfNuirvyuAqq6VJSG 6tffTsuyXd08BFA7AjyntR8HA3URCob3Es3JWctjqG1/QEff3outM+YAm1z2fGLjj54i xBiw== X-Gm-Message-State: ACrzQf223f8JjNH5NewJSpPeygGxDoi0guqjgcYwcuHMkfCf/XeQUm30 lfSfx5WNrIM03H+ZE1P7Cz8= X-Google-Smtp-Source: AMsMyM7jsEKb+jhtAMZz14QrVwXhq59qrHDM300z2XniVkRWpRp+l8VZmMbO4pzcrNMY2TcEeeAHEg== X-Received: by 2002:a17:902:d484:b0:17f:7437:565d with SMTP id c4-20020a170902d48400b0017f7437565dmr4892551plg.154.1665747828641; Fri, 14 Oct 2022 04:43:48 -0700 (PDT) Received: from hyeyoo.. ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id d5-20020a170902cec500b00178a8f4d4f2sm1542251plg.74.2022.10.14.04.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 04:43:47 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/slub: remove dead code for debug caches on deactivate_slab() Date: Fri, 14 Oct 2022 20:43:22 +0900 Message-Id: <20221014114322.97512-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RyFNLKV4; spf=pass (imf03.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665747829; a=rsa-sha256; cv=none; b=Dn3Mrclsoo6G9uD8jwoq36N//I+7JWzz0prEq97bk4tym97sPQ/3M1FJiDh8A0PVL3QCHK U/pMZVpT00X22io6gQ/K6C0P111VqQ5JeTOWnXstK/oZQJZDKRTKDjQqKsbOHkriGkalVB x4G7k8UILnKKc20HgduEo5i5GDlk914= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665747829; h=from:from:sender: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:references:dkim-signature; bh=XtwckXY6GxG78kcpO8+3k1Gq+VT6rNZTsbhQDdeEaDs=; b=767oDQAByFarOytH1AdrUREfoeKI5gJHchI7XlnQBsjB9KXVC2D/ok3MjhkBrH4++tsfNx Ng3Ik6QqMupSliyNgrYO5tyrIYc4x5Z0ybKTQ0PsLHT++zBd5GWESEMAU8bvhgdop1UeOu Zmqa+comX+wkpG3i04bTdSIG0J7pdpc= X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RyFNLKV4; spf=pass (imf03.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: DE45D20027 X-Stat-Signature: wayfxn4qfj1hpt6dhn1e54jrgzsi8751 X-HE-Tag: 1665747829-843174 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: After commit c7323a5ad0786 ("mm/slub: restrict sysfs validation to debug caches and make it safe"), SLUB does not take a slab from partial list for debug caches. As deactivation isn't needed anymore, remove dead code. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/slub.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 96dd392d7f99..e2215240954d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2411,7 +2411,7 @@ static void init_kmem_cache_cpus(struct kmem_cache *s) static void deactivate_slab(struct kmem_cache *s, struct slab *slab, void *freelist) { - enum slab_modes { M_NONE, M_PARTIAL, M_FULL, M_FREE, M_FULL_NOLIST }; + enum slab_modes { M_NONE, M_PARTIAL, M_FREE, M_FULL_NOLIST }; struct kmem_cache_node *n = get_node(s, slab_nid(slab)); int free_delta = 0; enum slab_modes mode = M_NONE; @@ -2487,14 +2487,6 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab, * acquire_slab() will see a slab that is frozen */ spin_lock_irqsave(&n->list_lock, flags); - } else if (kmem_cache_debug_flags(s, SLAB_STORE_USER)) { - mode = M_FULL; - /* - * This also ensures that the scanning of full - * slabs from diagnostic functions will not see - * any frozen slabs. - */ - spin_lock_irqsave(&n->list_lock, flags); } else { mode = M_FULL_NOLIST; } @@ -2504,7 +2496,7 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab, old.freelist, old.counters, new.freelist, new.counters, "unfreezing slab")) { - if (mode == M_PARTIAL || mode == M_FULL) + if (mode == M_PARTIAL) spin_unlock_irqrestore(&n->list_lock, flags); goto redo; } @@ -2518,10 +2510,6 @@ static void deactivate_slab(struct kmem_cache *s, struct slab *slab, stat(s, DEACTIVATE_EMPTY); discard_slab(s, slab); stat(s, FREE_SLAB); - } else if (mode == M_FULL) { - add_full(s, n, slab); - spin_unlock_irqrestore(&n->list_lock, flags); - stat(s, DEACTIVATE_FULL); } else if (mode == M_FULL_NOLIST) { stat(s, DEACTIVATE_FULL); }