From patchwork Fri Jun 14 22:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13699161 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 D872FC27C6E for ; Fri, 14 Jun 2024 23:12:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7A1A6B0139; Fri, 14 Jun 2024 18:59:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B02AF6B013A; Fri, 14 Jun 2024 18:59:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9548B6B0142; Fri, 14 Jun 2024 18:59:58 -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 74E4B6B0139 for ; Fri, 14 Jun 2024 18:59:58 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 049A61A07FC for ; Fri, 14 Jun 2024 22:59:57 +0000 (UTC) X-FDA: 82231013676.25.AADE1AC Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf24.hostedemail.com (Postfix) with ESMTP id 53B2A180008 for ; Fri, 14 Jun 2024 22:59:56 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=GKXEm74D; spf=pass (imf24.hostedemail.com: domain of 3a8tsZgYKCO4ikhUdRWeeWbU.SecbYdkn-ccalQSa.ehW@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3a8tsZgYKCO4ikhUdRWeeWbU.SecbYdkn-ccalQSa.ehW@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718405993; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=Ov9SboQQfNn2c9IqfdAPrbvWYYp8I7N4DcF5qw+Lk1g=; b=cYB5gdCnfT+19GycaiyzUnRqATQiCG21d2HOpxcjsP2U2ELT8J8teBvEAkhOf2aIZpwaEo 5/cjy50WTnFPppTXj4e9/FRJqSOhRfBmOCFfmN3RpX3OZu5aKSlq3Oc6UJJ7J7uBPjt+ju gF9Ig4UvnJ5+hov0S/dFxjKcyHFyZns= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718405993; a=rsa-sha256; cv=none; b=qBbkXcLhV3tk047sUHl/OhRaS0IasFvy2UWKL3eK22BpNqLB+tn5FQUTN0AfY+T25A7ckU z+Cfrej9OSn7fyuf8ktyf99FBeEvazqWgLK2J3doVWOUB5qmkkvKYTmmPFJN/YIceFVFLc LFQ8Ml/AQxDMN0G0Gbuwl3sLQ3UdZo8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=GKXEm74D; spf=pass (imf24.hostedemail.com: domain of 3a8tsZgYKCO4ikhUdRWeeWbU.SecbYdkn-ccalQSa.ehW@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3a8tsZgYKCO4ikhUdRWeeWbU.SecbYdkn-ccalQSa.ehW@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62fb4a1f7bfso56065857b3.3 for ; Fri, 14 Jun 2024 15:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718405995; x=1719010795; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Ov9SboQQfNn2c9IqfdAPrbvWYYp8I7N4DcF5qw+Lk1g=; b=GKXEm74D6vYYoN3u/XcEvCrC32wlgKmjRUYCvyOhL2ZaDjEA8XXV8bWX2lotqpdlQe nMrT1dm+x3m9Gp+Xpk49ECq0mLiCNfHxpLJ8+NqEU1Wq9Fguo7jXRGDHi7kSAmIMvqXa umYRGmTMyK/SVCxXHQtebkoi44S15k7W/BZ6SJRP3/AcwxnOTCylaBcvoqx7DRgbjhTN bGMAUddvdWVtXn3OWvpmcywgDjp+4Y/3wOYFL//KhvYZsV8D8t0X+Mk9P3XCLPFFMjBk py8WE79tJU8Vhm8ryVRT81OsFbWY1usXn5m0WGno1tr0CFUIk0a75038NtexOPoGzdtI G6Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718405995; x=1719010795; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ov9SboQQfNn2c9IqfdAPrbvWYYp8I7N4DcF5qw+Lk1g=; b=SJJNqtYTXid57LC8kXgfL2R2JH6vAkyFuq19W9ZRmxvij7pjDcyTC5KASciBVvSBop zdWurueQU32PRecpkB9RsXlj++9HzuMsg7smWRRSP6NmWTs7+qj2dQkMfOD4ZPQu1USk gYA20JZNXjPh3DNcXKXiQm01r4gdhRHkBrnXsie9F3Q41pKZCslCHgSShOQUJAKmv3z9 OLMJsbwrOc366v8PBNqY9lqHH9QcSRWlhDh99kJmdamaiApBNRNsLsBWOZvcmU+G5cRO tIU4xoEgFoFLZxTlmkiczMJ0Ae8JRJzzIsnaIrcnyP8trN8gii6uM1R5G4nR7Wl1Ugp2 PDFA== X-Forwarded-Encrypted: i=1; AJvYcCWjUvTXxUOsmYYDr6eLFUAN7vMJXS8nEZfl9y6sOrY2KxUkmtOUkaKlU9iTBNTYahbqLiy5y9Bki52Cs4RKBlbdqSs= X-Gm-Message-State: AOJu0Yw9LDJP8LBQbjjB8CcAn2BcSxrVKKbLg7bSet+CSA7v8s9u7bmN tbO+58ESDBjRQ7A2hlKSTfwxJ7HnYzcaEsjRPqCS9TIK6RaSQZmU74bpIkcwT1/NypRhS6kn4Ro KMQ== X-Google-Smtp-Source: AGHT+IHrPdYXJQ88SIVzQ5uVnIDoZr8qnm3pGhWwZruCCZDr6O/84844meKb98AqqszmQhjmVqBN2EZJARI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:92f9:5432:a95e:d0e8]) (user=surenb job=sendgmr) by 2002:a05:690c:d87:b0:61b:791a:9850 with SMTP id 00721157ae682-6322480e75dmr10421527b3.9.1718405995393; Fri, 14 Jun 2024 15:59:55 -0700 (PDT) Date: Fri, 14 Jun 2024 15:59:51 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Message-ID: <20240614225951.3845577-1-surenb@google.com> Subject: [PATCH 1/1] mm/slab: fix 'variable obj_exts set but not used' warning From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, vbabka@suse.cz, pasha.tatashin@soleen.com, souravpanda@google.com, keescook@chromium.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , kernel test robot X-Stat-Signature: 5rhp6u5c1k5sd3eojmp9cs9yix3idj3m X-Rspamd-Queue-Id: 53B2A180008 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718405996-805415 X-HE-Meta: U2FsdGVkX18ILTyR8Tri4tv02mNfax1OsaKQGGUj0da2Y8QB9w6v8xDDRqqxIeuNBcjsgspspbbAJrVmZJ3Lspr31mYmmTPsqokrXsu1c+uilsXWPsaXeZ0meCBJKaxvnfoMdJpCdmQKKhS2AYSkYYjRAOPGNi5w4c7L05LvuqNKRRAkLq13x+YG8GM0VGP6fRMXskbQvXFDBbUT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DGCIKwGbtxcdE6EyyNZV96jbuGK7xaqYlPuncegRP3mW0VBmodAABr1nPHqUtJmwmyLzgMEIrsfBLQ0R8jIcwrLe1b/SO/CxSihc7ryaR+ZHHWtZU1/uxmHK/eKrBdult8sFUsDEFrepIewHcRIP8qJohp+t46IFZohAbPNp30VXTpUsMmkygdAJtjVXaXjkeZ/MJCh2dEy7wPvmK7XRm05n4UhABKfzp3ZM6tEz7CMiipRXR1D0hopZAvlMXxdHLfyIzZvwwuuTXt60f+xLQG65en4HyQqrZ8LmevT9zYFIGPRcLn1bhXb6VnNdLF7OQ2t7masExeSXrvR2j6qlNNQrzbUenayTGsRbjEk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000235, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: slab_post_alloc_hook() uses prepare_slab_obj_exts_hook() to obtain slabobj_ext object. Currently the only user of slabobj_ext object in this path is memory allocation profiling, therefore when it's not enabled this object is not needed. This also generates a warning when compiling with CONFIG_MEM_ALLOC_PROFILING=n. Move the code under this configuration to fix the warning. If more slabobj_ext users appear in the future, the code will have to be changed back to call prepare_slab_obj_exts_hook(). Fixes: 4b8736964640 ("mm/slab: add allocation accounting into slab allocation and free paths") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406150444.F6neSaiy-lkp@intel.com/ Signed-off-by: Suren Baghdasaryan Acked-by: Vlastimil Babka --- mm/slub.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) base-commit: c286c21ff94252f778515b21b6bebe749454a852 diff --git a/mm/slub.c b/mm/slub.c index 1373ac365a46..4927edec6a8c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3902,7 +3902,6 @@ bool slab_post_alloc_hook(struct kmem_cache *s, struct list_lru *lru, unsigned int orig_size) { unsigned int zero_size = s->object_size; - struct slabobj_ext *obj_exts; bool kasan_init = init; size_t i; gfp_t init_flags = flags & gfp_allowed_mask; @@ -3945,9 +3944,11 @@ bool slab_post_alloc_hook(struct kmem_cache *s, struct list_lru *lru, kmemleak_alloc_recursive(p[i], s->object_size, 1, s->flags, init_flags); kmsan_slab_alloc(s, p[i], init_flags); +#ifdef CONFIG_MEM_ALLOC_PROFILING if (need_slab_obj_ext()) { + struct slabobj_ext *obj_exts; + obj_exts = prepare_slab_obj_exts_hook(s, flags, p[i]); -#ifdef CONFIG_MEM_ALLOC_PROFILING /* * Currently obj_exts is used only for allocation profiling. * If other users appear then mem_alloc_profiling_enabled() @@ -3955,8 +3956,8 @@ bool slab_post_alloc_hook(struct kmem_cache *s, struct list_lru *lru, */ if (likely(obj_exts)) alloc_tag_add(&obj_exts->ref, current->alloc_tag, s->size); -#endif } +#endif } return memcg_slab_post_alloc_hook(s, lru, flags, size, p);