From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C74E6C4707F for ; Wed, 26 May 2021 02:38:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F78E61430 for ; Wed, 26 May 2021 02:38:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbhEZCkC (ORCPT ); Tue, 25 May 2021 22:40:02 -0400 Received: from smtprelay0022.hostedemail.com ([216.40.44.22]:33004 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231843AbhEZCkB (ORCPT ); Tue, 25 May 2021 22:40:01 -0400 Received: from omf09.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 8A5E6A2D0; Wed, 26 May 2021 02:38:30 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA id F39FD1E04D5; Wed, 26 May 2021 02:38:28 +0000 (UTC) Message-ID: Subject: Re: [PATCH 3/3] slub: Actually use 'message' in restore_bytes() From: Joe Perches To: Stephen Boyd , David Rientjes Cc: Andrew Morton , linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , Joonsoo Kim , Vlastimil Babka , linux-mm@kvack.org Date: Tue, 25 May 2021 19:38:27 -0700 In-Reply-To: References: <20210520013539.3733631-1-swboyd@chromium.org> <20210520013539.3733631-4-swboyd@chromium.org> <858b8d14673a200c3c2162fb7a9bf891ecd2a2d9.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: apm3jtknofu18oxwznwijb89fja8hhrq X-Rspamd-Server: rspamout02 X-Rspamd-Queue-Id: F39FD1E04D5 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19tJgMR7ep1kGpvtE7bmjdOvSYV0/RJpvI= X-HE-Tag: 1621996708-919670 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-05-25 at 22:32 -0400, Stephen Boyd wrote: > Quoting Joe Perches (2021-05-25 00:37:45) > > On Sun, 2021-05-23 at 22:12 -0700, David Rientjes wrote: > > > On Wed, 19 May 2021, Stephen Boyd wrote: > > > > > > > The message argument isn't used here. Let's pass the string to the > > > > printk message so that the developer can figure out what's happening, > > > > instead of guessing that a redzone is being restored, etc. > > > > > > > > Signed-off-by: Stephen Boyd > > > > > > Acked-by: David Rientjes > > > > Ideally, the slab_fix function would be marked with __printf and the > > format here would not use \n as that's emitted by the slab_fix. > > Thanks. I can make this into a proper patch and author it from you. Can > you provide a signed-off-by? The restore_bytes() hunk is slightly > different but I can fix that up. If you want... Signed-off-by: Joe Perches > > > --- > >  mm/slub.c | 8 +++++--- > >  1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/mm/slub.c b/mm/slub.c > > index ee51857d8e9bc..46f9b043089b6 100644 > > --- a/mm/slub.c > > +++ b/mm/slub.c > > @@ -702,6 +702,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...) > >         va_end(args); > >  } > > > > +__printf(2, 3) > >  static void slab_fix(struct kmem_cache *s, char *fmt, ...) > >  { > >         struct va_format vaf; > > @@ -816,7 +817,8 @@ static void init_object(struct kmem_cache *s, void *object, u8 val) > >  static void restore_bytes(struct kmem_cache *s, char *message, u8 data, > >                                                 void *from, void *to) > >  { > > - slab_fix(s, "Restoring %s 0x%px-0x%px=0x%x\n", message, from, to - 1, data); > > + slab_fix(s, "Restoring %s 0x%px-0x%px=0x%x", > > + message, from, to - 1, data); > >         memset(from, data, to - from); > >  } > > > > @@ -1069,13 +1071,13 @@ static int on_freelist(struct kmem_cache *s, struct page *page, void *search) > >                 slab_err(s, page, "Wrong number of objects. Found %d but should be %d", > >                          page->objects, max_objects); > >                 page->objects = max_objects; > > - slab_fix(s, "Number of objects adjusted."); > > + slab_fix(s, "Number of objects adjusted"); > >         } > >         if (page->inuse != page->objects - nr) { > >                 slab_err(s, page, "Wrong object count. Counter is %d but counted were %d", > >                          page->inuse, page->objects - nr); > >                 page->inuse = page->objects - nr; > > - slab_fix(s, "Object count adjusted."); > > + slab_fix(s, "Object count adjusted"); > >         } > >         return search == NULL; > >  } > > > >