Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4154728pxj; Tue, 25 May 2021 01:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf/mAKxbWH3JnCF92I+9/ZddS6WRRUyAxdJZSvmBGAoGlnv1UgI5ijroGCJN6spFjcETBF X-Received: by 2002:a05:6602:90:: with SMTP id h16mr18391214iob.194.1621931170493; Tue, 25 May 2021 01:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621931170; cv=none; d=google.com; s=arc-20160816; b=mpl8r2KxItIR+WhB771/76qnV0CVphxar17oqJUM7y67DrvNmudXm3u9G56YKY4Cxe eY/kBv884qm5pmPjwfwgO8xnxofKCG1dc/W7FDRjiZULxPzfeTK8/0Ap6Hpphgkh3CzG mxWvhI8m+LawKoIDV415i6To/IsbpazFJJxl9LkuPYOBztK66MLpGO1cdbcyv45rjBcG mCx4A8QcvDQs2lOuPntd321+zvAPXatoilnCJtcqCdJ5mgDfrXvRCU7pKg0CHsBEtNzA YBC8COMKAy0AfzdNdrxsRdy+SWaUx19CJdDenOWqSGD+garl7co5Rb0lRi1cOukzIKiV hNXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=5X4kZPyWYKqundgOgrk7N1YzrtQevBW3HWhGVaBQucc=; b=ckcVWjT9/j4sDoscsvMHcWNd6KaxWLGJPfyRzuix1L9e9fYHJXjXEF8Hrfe9fu91W4 16DqJl8wX321u/pDbYnMUFyhrtOcpYqsKkp5F68JERa9VlR7Gtb386LDkNi7NQqfUP3Z PIT0t2GLYqS5ZASD4+0XQT7V01T5NOoROBGEMJj21tGoTGLpsLq2jWKHP3M2wua4WvGZ /lp6O4hTmcmnx1GZfBWf4nlHCf5Luh3MqfV/3heZfe2niWPp8J6DQ4eH05HngDdCGVgo 60gGOipyaP3ie70dFBKrPV7JZlz8xRB6SlB/VDn0uZowLx7ZPgNysCHVlKNGMwk9GSya Vxew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si15802317ilp.53.2021.05.25.01.25.56; Tue, 25 May 2021 01:26:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231745AbhEYHjT (ORCPT + 99 others); Tue, 25 May 2021 03:39:19 -0400 Received: from smtprelay0194.hostedemail.com ([216.40.44.194]:57992 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231477AbhEYHjS (ORCPT ); Tue, 25 May 2021 03:39:18 -0400 Received: from omf05.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 9DCD4180A633B; Tue, 25 May 2021 07:37:48 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA id 23C45B2795; Tue, 25 May 2021 07:37:47 +0000 (UTC) Message-ID: <858b8d14673a200c3c2162fb7a9bf891ecd2a2d9.camel@perches.com> Subject: Re: [PATCH 3/3] slub: Actually use 'message' in restore_bytes() From: Joe Perches To: David Rientjes , Stephen Boyd 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 00:37:45 -0700 In-Reply-To: References: <20210520013539.3733631-1-swboyd@chromium.org> <20210520013539.3733631-4-swboyd@chromium.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 23C45B2795 X-Spam-Status: No, score=-2.77 X-Stat-Signature: hp4oszkbtk8hibi4rajk97noembbzdyk X-Rspamd-Server: rspamout03 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+6A9zOxGW+KQrsg23BagpNpPgeApq3g4w= X-HE-Tag: 1621928267-381165 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --- 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; }