Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1111447lqs; Fri, 14 Jun 2024 16:00:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYERn1tjh5HZ+OjIUzeXOca90WlOrw63GCdYfwoDeFBb/1+vTptI40YCaxDFNlQB22qqVlMUDrromSzvrRqIz+NeowG2XEEKxocYo2XA== X-Google-Smtp-Source: AGHT+IGAow5W07lGHJtGK6r+u5IEdojIIXwZB+us0Y05FBZfZnvxW9Nk+VjidhPD10uUuGYb/UmQ X-Received: by 2002:a05:6870:5689:b0:254:8137:a654 with SMTP id 586e51a60fabf-2584298e458mr4250734fac.27.1718406003805; Fri, 14 Jun 2024 16:00:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718406003; cv=pass; d=google.com; s=arc-20160816; b=shHYExarODMZjJKFzD5TyWUZ8JQoCC71bQdJfaR6JQ96ey6FxP+2iTT8u1YoplFis6 NYRZ6UWM5WzyH2slr7tYzdAUwb1v+65OMc2JinyffQAVm80SHwABjtdIA5gLPnjepsux RMmH1IRJpH0ZBELFc5alm+6+7RjB+ng0JMxKgnHkDscN1wr9Q5927SkA9MC2c2ySCvdv Ac5xxP1WmAJC7gip/U93YBuv0SkOTCPZ9F1SKgIJG1XyfaNXrlhb+TX5hQ6rXew4nCWN Mrjca0dpbjZm6OrKVKkpOXbM7MKdJ0lUjYni9W2lyANSL/vvRzQrKuQbuTIRpbO8g4GA UOiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=Ov9SboQQfNn2c9IqfdAPrbvWYYp8I7N4DcF5qw+Lk1g=; fh=oT3upU4u6gFHM8r2aUIG7b9nU8Rl0c2+R+u6UMw43gk=; b=kudmZBy4Iz6/3aoWBUOET+YbCaOELVKUcn/zovU6dMMBoeTPiceDvZJwJwFhNFAxM6 qzVtGMJrIRVwZ3yasYMcGd/G5OstcKMYq0u1KsizPxec72uYv1VjCQ6hfjNQtd68BYvr claH2U5Klxgu15ohwXiRktZp2iHbSwupAw0pKLU4BmoC072v2SEcNP3KO5FgNyF9iOSq bJjg9ui7ZK0h4rMQccmBB19OI4JO+WMkrTP6OgC6de7tAaWgSfjkEZ6TifAXlYf9i8Pk ZjrYuTRlawG+QI10KgE08kwDgiJyTj24gFJ3J90IBjv24Nlrp7rLc6mAX0Ovn7jt9fdh PLqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qmiMiqut; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-215546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccb99fccsi4682946b3a.337.2024.06.14.16.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 16:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qmiMiqut; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-215546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6B73F283286 for ; Fri, 14 Jun 2024 23:00:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCB33186E52; Fri, 14 Jun 2024 22:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qmiMiqut" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E112137905 for ; Fri, 14 Jun 2024 22:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718405997; cv=none; b=lt42SfjxW19miX1vYabzPs+8kqkSqSVAJ4+UD/7VH/0JK36Vb1q1LZQyEkmVHaAHKFMtUXHwWLiNb1IyNgpLq9nROztuMjFrEn74KFjmxsjru8Z/+gACE6QYjst1kc06JiQ2jebRhLMeRjmmiKVKAlzImbR5bUr+2B+r6Myhj8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718405997; c=relaxed/simple; bh=Jvx/D00bdKpscL8H+BgKzqSrJpNVmyQG4WGp2oeFAFk=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=qiGlxiF/ywdWGTUTeGqabKtenwvECRz0nL6nWkWOIDmo1nwn8EZ11JEQ07AHWRzTY0un6idsGcUcoCucsxA5ntaQmJHfU+nsyQ9iWhUoru0/bm6bhmNRMfJ2g/HNmcSUmJe5SjfU2U27D7ZCQbDd7+XVdo0Fgwbqb8LM0toZpnM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=qmiMiqut; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627f43bec13so45549817b3.0 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=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Ov9SboQQfNn2c9IqfdAPrbvWYYp8I7N4DcF5qw+Lk1g=; b=qmiMiqutFLkbD5UP0baGkarHdQ1YH/T/2Y3NvnD+oCgb1OHe0NcQohwPKiMUP0Rt0v i03StLSzwlZo7ZdE5i1IPprvGV/i5e1heegE/fb0mGE6OW2VHKqubiy5Oa3oXRi17+4z xUnbJdeAXDX2A47CW+RGCC3LOGV4OGsbCJLe/+n2fe/OY8vPCkc/bcDjoLUd8JOfMQ53 a2qid7+s1VLEFuHr9P3Stg+4lzh/P0xaebX/HbXIRvmyrqRbYEsat7fkxKWdMiX5hW6y 6+OTy9y9C7yf+ny7IiwEELPaAMAy/hHqqoz7NlVpkps/GkKEOMjn0vH6tsTApsqHpBak 3wQg== 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=Wa4+VYqgOv8BXa8jP+DOPwoqwF+oKy2phR2PqmqVJecjR05ZPwS1CugMMhzxG9YbUn 3PhTqJbIyKM1q4aieflHBSswIJT3wa58thVmIgf+BylHYdIbaQl6dJDvWc4VcdOCeSJ6 e9Z9YgNsGicjRhh9DzV/GvabZfuDIXJfLXeX+4+3ji4BlsEHvUQTGEGYELEDwAih/MCY UuG7cRx6y7rUFRIaozISl56crw6UiaF0ZWIcSC0OJH6/BytiI//MArU8L7yQKTNBoZfM OJI0itudzuc1dRl7uHikBeg2TAmZj+1OPNPNEHn+YH5iQC3Xr0prunbHZrJHsq+5quna EopA== X-Forwarded-Encrypted: i=1; AJvYcCU5OdR9z+Kdd4qh6nvMjt2/ZqXlb0LSlPCg0egPZngwz+9JSBqgIZzTKIl7MRFAqiGQIg9wIYELRv1GXts17PD326Ygxv/2Q2VFPcfL X-Gm-Message-State: AOJu0YysQ2WuteG1B0usP/TB9oYpd/9dc53azr1g6NHSRBhtXhpIiRmZ FvUluv0SqtY2ONXLhFugdyAw3pV6T11dMPYafNdnprUGCSkGnmGNZTElfFxHFa48KpPQCX2JYTs eDQ== 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Type: text/plain; charset="UTF-8" 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 --- mm/slub.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); base-commit: c286c21ff94252f778515b21b6bebe749454a852 -- 2.45.2.627.g7a2c4fd464-goog