Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1691097rwl; Wed, 12 Apr 2023 17:25:21 -0700 (PDT) X-Google-Smtp-Source: AKy350ZqUfFIkBc2r1J1osqR2B+Hb6BM9eb6Og1CMyEl3a4p9spervhWvHY9n/BxOIYqJDgF5F0q X-Received: by 2002:a17:903:11cc:b0:1a5:a1b:bbd8 with SMTP id q12-20020a17090311cc00b001a50a1bbbd8mr124780plh.45.1681345521038; Wed, 12 Apr 2023 17:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681345521; cv=none; d=google.com; s=arc-20160816; b=eU1W/CisH8PzGkMyS11RZj41JhsOm67xVA/wdupvPPgxi7bdWCSdWwGgKYoSEpfRgK 0J+SWrQePB9XmqfSPwamkPCsc7pLTyXHAC7Au4qWlhYiCC8UfNlW/RGtGBO0Pqke6d+t ZHw5Q2r2QLSa0jtr3smpi4AYbiYwJ/GZ5WAJQeRiUkqnlwv5asgLvfPkvWPGbsOyJDtB zMMeFiYeWH5SmWF8n5zTInJ8mxTHwO9g6QVDEOFkmt7dtODa3NHIyOezt5DgIfivJqOa inZbpnvH3fRZDKkvD1d5QMoH5lr+/tE5uIoBQtFzE3MeGFfFsfX/g6jqhviMT6gRzv82 qzbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Wtul3Z8jJEzUyTGyM60eqK7vbLWh1bkMyVJkOssHu7M=; b=g+tvP6cNKgHLpk3DK4eIuGLcqdNU2badO29f+nTwmu1howgaZ3ioUFBR2jyyXuBz0J KmBmD8sGptLWm7YGSB8+QR8eIVVGv2peEmDLYhsmhtWRqwjO+cZxq8wwt4l++f78FOKb OynSAQ+jRGDZKpmASCBkO4sGdyJ91YXQbIrg4Uvkj2aelP1VWOMGeKzsgYvTsNeD7oxV P1Ci7PtLreKez0/c/Du5fyCtjcAD+NU00I+BBGNCoRqPPGJ/PPnroLaQ7N6pGPKQM94D /cieWrmUvRiKaEuYy4QYikGvHdkr5rDxF9HGipHERJBmQ+fexLiB7hqMJehVIU7bYbzH wC4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="rtY0/9Ot"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170902b78800b001a643d9f1b8si389424pls.643.2023.04.12.17.25.09; Wed, 12 Apr 2023 17:25:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="rtY0/9Ot"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbjDMAYe (ORCPT + 99 others); Wed, 12 Apr 2023 20:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbjDMAYd (ORCPT ); Wed, 12 Apr 2023 20:24:33 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3CF269F for ; Wed, 12 Apr 2023 17:24:31 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-54fb615ac3dso38866307b3.2 for ; Wed, 12 Apr 2023 17:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1681345471; 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=Wtul3Z8jJEzUyTGyM60eqK7vbLWh1bkMyVJkOssHu7M=; b=rtY0/9OtcurYPtYIapuV/k4bBgvp1yNBP3UXLU61ovIOF9y/ROGOEKmEANW7euSGJg p8Gv5AMujfvSmbRylD2GcuNzaksfjuhHh7EDCBsdt4YgEU9kLOTOIUGgeMbMYdx66xt6 BaywR9zxv7ykjNxurW+lI3iy/ZEH5802jtMck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681345471; 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=Wtul3Z8jJEzUyTGyM60eqK7vbLWh1bkMyVJkOssHu7M=; b=FZH5/woKuHlO9qzJo+zzD4Vcf1zYl1MbxlgWpXQNaaywiGFFgfj/ozfBhUP0oCG6dJ UXmupvhexbevKv1jOKAUnUbhAgv7yXQGuMIRa3xrScDCMcbWStJa7KNadubnZVPz1U37 1iD4QROZdUQq+IYIJ2S5qgyFPsrlCpE84UPJ9iasb9skOy8zisj8Xfc50/gD00a4Y581 LsKUCogius6KKhDxsW4VvJbUBeADio0TZjXVyF6wK5DQPsfgJZu564ohG0fzlG1GQ7ZK uxMqyK50CWOa1LJM5pYNkjSckhTaFV2EPKDnnd8BSDyb6/9ANMDWx6VhHEzVIc3/NCcy qmHw== X-Gm-Message-State: AAQBX9cArVyolwbSDdjBsQ14pHuM54Klup1+7KKQ4aJWNfkUhTIOGuxr N0awH9HrfYc0QQoEYrruiD9tJVrWBth2038RUOEwgQ== X-Received: by 2002:a81:ef02:0:b0:545:883a:544d with SMTP id o2-20020a81ef02000000b00545883a544dmr224210ywm.9.1681345470692; Wed, 12 Apr 2023 17:24:30 -0700 (PDT) MIME-Version: 1.0 References: <20230411130854.46795-1-zhengqi.arch@bytedance.com> <932bf921-a076-e166-4f95-1adb24d544cf@bytedance.com> In-Reply-To: From: Joel Fernandes Date: Wed, 12 Apr 2023 20:24:19 -0400 Message-ID: Subject: Re: [PATCH] mm: slub: annotate kmem_cache_node->list_lock as raw_spinlock To: Qi Zheng , Steven Rostedt Cc: "Zhang, Qiang1" , Boqun Feng , Vlastimil Babka , "42.hyeyoo@gmail.com" <42.hyeyoo@gmail.com>, "akpm@linux-foundation.org" , "roman.gushchin@linux.dev" , "iamjoonsoo.kim@lge.com" , "rientjes@google.com" , "penberg@kernel.org" , "cl@linux.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Zhao Gongyi , Sebastian Andrzej Siewior , Thomas Gleixner , RCU , "Paul E . McKenney" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 12, 2023 at 2:57=E2=80=AFAM Qi Zheng wrote: > > > > On 2023/4/12 14:44, Zhang, Qiang1 wrote: [..] > > Maybe no need to convert ->list_lock to raw_spinlock. > > > > --- a/lib/debugobjects.c > > +++ b/lib/debugobjects.c > > @@ -562,10 +562,10 @@ __debug_object_init(void *addr, const struct debu= g_obj_descr *descr, int onstack > > unsigned long flags; > > > > /* > > - * On RT enabled kernels the pool refill must happen in preempt= ible > > + * The pool refill must happen in preemptible > > * context: > > */ > > - if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) > > + if (preemptible()) > > fill_pool(); > > > > db =3D get_bucket((unsigned long) addr); > > Ah, this does fix the warning I was encountered! Actually fill_pool() should be safe to call on !CONFIG_PREEMPT_RT kernels as it is GFP_ATOMIC, however with the above change, that goes away just to satisfy a false-positive report. Because now all !preemptible() sections on !CONFIG_PREEMPT_RT kernels cannot call fill_pool(), right? So you will not end up filling the pool when it is safe to do so? I think it would be better to fix PROVE_LOCKING / CONFIG_PREEMPT_RT instead of degrading !CONFIG_PREEMPT_RT just to satisfy a false-positive report. +Steven Rostedt as well. thanks, - Joel > > > > > > > > > Thanks > > Zqiang > > > >> > >> > >> Regards, > >> Boqun > >> > >>>> > >>>> It's indeed unfortunate for the warning in the commit message. But > >>>> functions like kmem_cache_alloc(GFP_ATOMIC) may indeed be called > >>>> in the critical section of raw_spinlock or in the hardirq context, w= hich > >>> > >>> Hmm, I thought they may not, actually. > >>> > >>>> will cause problem in the PREEMPT_RT kernel. So I still think it is > >>>> reasonable to convert kmem_cache_node->list_lock to raw_spinlock typ= e. > >>> > >>> It wouldn't be the complete solution anyway. Once we allow even a GFP= _ATOMIC > >>> slab allocation for such context, it means also page allocation can h= appen > >>> to refill the slabs, so lockdep will eventually complain about zone->= lock, > >>> and who knows what else. > >> > >> Oh, indeed. :( > >> > >>> > >>>> In addition, there are many fix patches for this kind of warning in = the > >>>> git log, so I also think there should be a general and better soluti= on. :) > >>> > >>> Maybe, but given above, I doubt it's this one. > >>> > >>>> > >>>>> > >>>> > >>> > >> > >> -- > >> Thanks, > >> Qi > > -- > Thanks, > Qi