Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1253991rdb; Mon, 19 Feb 2024 08:56:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUbGnki83DrGTrXUxL9HH+moWOvpVKhmFo7D9RpVVbk6OyxZmkzHh/9s9S79/lanT4kMimf8dtmy6Sm6Q/4xnRCo6mE5hCha9G+QkSuqw== X-Google-Smtp-Source: AGHT+IEjXQkaoU3HglR8pkvoVnSFMBpfAkxwykIWzi3IYOcW254qY6egtPAQrpGh7wDe98QZNijY X-Received: by 2002:a05:6870:224c:b0:21e:39d1:5464 with SMTP id j12-20020a056870224c00b0021e39d15464mr12045499oaf.8.1708361789695; Mon, 19 Feb 2024 08:56:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708361789; cv=pass; d=google.com; s=arc-20160816; b=pdF9dQqC5LCFFmSgoEB1cOU+eG1iGG8ntFFOJnwngep0W0esFo4DTo2ukQmnKRXkj5 uVH/KaFnqsC3eNuH3dg4qNz45wNG8x3eFhm5vv0iZGDGvawcNP+NqeQJu0DyaX7LewFX RBx5d5P8DcIJp9QF/fFmZromAxeuaYvxha3LPKs/3aMCO57yilp4hSQEKcynaObpKfc2 AxkLxyYMsaGrGffT1H579q0b8P3RV/wVzEd+35DVqkIH82idu2Iiv+g/NXwUuYDvrNh3 1JPmIPP2IESOaThdDsO6pjyaAC+SOOgtTsxOQTaFq7xG6GAzj5c2V3Z1tlJI9clIw2ro pypg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=MC1JxayV7V5FEwBjiEEHat04AtMi8UdAlknxmmQHPbY=; fh=NKz9qKL0rdOA9jnRLinKO7rSsb4HL/5GQYp1P/ERjm4=; b=cDZocblga7WGSmgvFS+gy0SZB3+OfQjymQPgcZexblrcL8WRJjuftsUycsXD/Kvmkn hLdq1sHTiXMvQRVcw6mz1MKhMmbLKmPxFuSSUd2282noA3LrX2wkKpkGB1jlbXHHl0Fs zg39vt2BEsajqxFPpc0r1NxVVCv30fhC3a//+wKKX7zNZuPkvIKCzEKB+bLYE8xPQ0lI HlBObq0xnDZhoUwr+nwXWLsH9ZU3+KqNTGZLaQ33m1FrkgwBS5aGBw/pl8mdmmhU/ww7 s6RPyKlLssTSd37xpGi7BlnWOuKHUwIZwBUf9po68NaQnTqJH6k6rgjzt11TcvaP+dEX tDtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="MkZ/IxZ4"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-71717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d12-20020a05622a05cc00b0042bf171ffe8si7627165qtb.524.2024.02.19.08.56.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:56:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="MkZ/IxZ4"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-71717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71717-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1B1911C23882 for ; Mon, 19 Feb 2024 16:55:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8519C446A9; Mon, 19 Feb 2024 16:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MkZ/IxZ4" Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 C42CA41C8B for ; Mon, 19 Feb 2024 16:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361738; cv=none; b=RH9EqevH2BRHpuzGGo6yGorXHOgcjiszW3RQJJ6bIGaHtwguhNp7VY8lnO/WXJ53SHzs2oPjSzca8SHZwVRF04nmEQ1BwrzzVE7cMGdA24WW8Y3jle6eNbVNRc3VzbZKeGEENQ5OSulRXq0xEDjdS//dBFefHrtDtcR/N8d6ybs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708361738; c=relaxed/simple; bh=L2Wk+KfPMqWFy+4dwx61nIYX1yKhjaAyyhWHKrdqFeo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JwsRUKDxMv550zliVs5btoLjiAbkeN/pgqmfSu66pVc6i0C+/BzIEFVWBWij+h97FO/bj76TC10OwDNzHrdPVPZ7Vnqa5r6bGzZWE1BLMcU4T1llX996Z24BqbOYrTu/Zl0NEggnH9tYMpZ+I9MEG7Nct3KTn3OEa9+2jx6a9yk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=MkZ/IxZ4; arc=none smtp.client-ip=209.85.219.174 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=google.com Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-dc74e33fe1bso4210709276.0 for ; Mon, 19 Feb 2024 08:55:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708361736; x=1708966536; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MC1JxayV7V5FEwBjiEEHat04AtMi8UdAlknxmmQHPbY=; b=MkZ/IxZ4QGXfI4ZTy9QDCdF6dyp0wZD+oD0HD8XIChpTjEQYwWiVrhhdipzC9NyIoX wLHW5WsTCcZTnzLVnhOYOz3zmUpOSnmKSJYLgsyjrRwWTGVpsApwlptLts+qEn4Qk0Un /dW/ZG24LaZivpClFG7/ubvZNAzi5kJ580ayfAjWOzSsccD70WRH6FVh2D9d+2PH2YOc MSc7F68O3oyldG67kbMOC+F6XuYzndFaavEgloTQqjeveKnHJse9DTh2pD9aMrYwTEK6 zlGzqZLMGn+1gmyVal04viaSjc+d0e5VrUXYKev2lgQbl5RMAAxRBv/mbKeatIQWWwjz /QCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708361736; x=1708966536; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MC1JxayV7V5FEwBjiEEHat04AtMi8UdAlknxmmQHPbY=; b=JxJIky94aT0DhE+q7iH//A0Ywgk4pWXKm8KChCSG7NFZnkJFPBJh1CyzwHvIR8y5M/ e1GmXk7TZoHm5PloapXoWiUvx+kCGw83cZBSsZXA3HyP7DFydfX2w+zBj51a3+ocectz GSvoj3iWceS5Bve/1fx/klPMWxsshjd5Ey96xnbBQwULCeTBrh4I14SRmuFdvvBgKlac DNFnMzMyW9K5S0a9dPmy5JYCb4qNl9tyqsu43h3E19NrUJ2qT4TvRlGftQyGpQA6HEfp I223Df4vOWazEnpo/KCBMBS7777WGXaz+w6FgPYig0Lw2/t3G4DO503Gfj08La7y1XuL ySbg== X-Forwarded-Encrypted: i=1; AJvYcCUs2mJTakoqSTjgFPbyDDOzclfE7NPZFy4P7xv48hNoUU2emD9tLMGPfk1fnhyMCPqcYYzHsHNWRYcg1Z+gPzKrhBR8Fk2FHZscCIMD X-Gm-Message-State: AOJu0Yy7XziubYLPrwq4UdSK0bai+1MQhtiGYirm5I5Dcc7PscYv/Zjc IDu4P5I+Jz+CHqrWosXIARYP44VZ8ZiYuV0r80wsm3TNyWBLlMaXbXRt/jIJtozzZ8oppXNvoj4 tGXOIARMWET6Qau0bPLiIjmyK5nFBCeFm1tF1 X-Received: by 2002:a25:d68b:0:b0:dc6:aed5:718a with SMTP id n133-20020a25d68b000000b00dc6aed5718amr10952783ybg.26.1708361735183; Mon, 19 Feb 2024 08:55:35 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-33-surenb@google.com> <5bd3761f-217d-45bb-bcd2-797f82c8a44f@suse.cz> In-Reply-To: <5bd3761f-217d-45bb-bcd2-797f82c8a44f@suse.cz> From: Suren Baghdasaryan Date: Mon, 19 Feb 2024 08:55:22 -0800 Message-ID: Subject: Re: [PATCH v3 32/35] codetag: debug: skip objext checking when it's for objext itself To: Vlastimil Babka Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 19, 2024 at 1:17=E2=80=AFAM Vlastimil Babka wr= ote: > > On 2/19/24 02:04, Suren Baghdasaryan wrote: > > On Fri, Feb 16, 2024 at 6:39=E2=80=AFPM Vlastimil Babka wrote: > >> > >> On 2/12/24 22:39, Suren Baghdasaryan wrote: > >> > objext objects are created with __GFP_NO_OBJ_EXT flag and therefore = have > >> > no corresponding objext themselves (otherwise we would get an infini= te > >> > recursion). When freeing these objects their codetag will be empty a= nd > >> > when CONFIG_MEM_ALLOC_PROFILING_DEBUG is enabled this will lead to f= alse > >> > warnings. Introduce CODETAG_EMPTY special codetag value to mark > >> > allocations which intentionally lack codetag to avoid these warnings= . > >> > Set objext codetags to CODETAG_EMPTY before freeing to indicate that > >> > the codetag is expected to be empty. > >> > > >> > Signed-off-by: Suren Baghdasaryan > >> > --- > >> > include/linux/alloc_tag.h | 26 ++++++++++++++++++++++++++ > >> > mm/slab.h | 25 +++++++++++++++++++++++++ > >> > mm/slab_common.c | 1 + > >> > mm/slub.c | 8 ++++++++ > >> > 4 files changed, 60 insertions(+) > >> > > >> > diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h > >> > index 0a5973c4ad77..1f3207097b03 100644 > >> > >> ... > >> > >> > index c4bd0d5348cb..cf332a839bf4 100644 > >> > --- a/mm/slab.h > >> > +++ b/mm/slab.h > >> > @@ -567,6 +567,31 @@ static inline struct slabobj_ext *slab_obj_exts= (struct slab *slab) > >> > int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s, > >> > gfp_t gfp, bool new_slab); > >> > > >> > + > >> > +#ifdef CONFIG_MEM_ALLOC_PROFILING_DEBUG > >> > + > >> > +static inline void mark_objexts_empty(struct slabobj_ext *obj_exts) > >> > +{ > >> > + struct slabobj_ext *slab_exts; > >> > + struct slab *obj_exts_slab; > >> > + > >> > + obj_exts_slab =3D virt_to_slab(obj_exts); > >> > + slab_exts =3D slab_obj_exts(obj_exts_slab); > >> > + if (slab_exts) { > >> > + unsigned int offs =3D obj_to_index(obj_exts_slab->slab= _cache, > >> > + obj_exts_slab, obj_ex= ts); > >> > + /* codetag should be NULL */ > >> > + WARN_ON(slab_exts[offs].ref.ct); > >> > + set_codetag_empty(&slab_exts[offs].ref); > >> > + } > >> > +} > >> > + > >> > +#else /* CONFIG_MEM_ALLOC_PROFILING_DEBUG */ > >> > + > >> > +static inline void mark_objexts_empty(struct slabobj_ext *obj_exts)= {} > >> > + > >> > +#endif /* CONFIG_MEM_ALLOC_PROFILING_DEBUG */ > >> > + > >> > >> I assume with alloc_slab_obj_exts() moved to slub.c, mark_objexts_empt= y() > >> could move there too. > > > > No, I think mark_objexts_empty() belongs here. This patch introduced > > the function and uses it. Makes sense to me to keep it all together. > > Hi, > > here I didn't mean moving between patches, but files. alloc_slab_obj_exts= () > in slub.c means all callers of mark_objexts_empty() are in slub.c so it > doesn't need to be in slab.h Ah, I see. I misunderstood your comment. Yes, after slab/slob cleanup this makes sense. > > Also same thing with mark_failed_objexts_alloc() and > handle_failed_objexts_alloc() in patch 34/35. Ack. Thanks! >