Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4960215pxj; Tue, 25 May 2021 22:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF5qsLkkW5uV/65VnJvlnzYPUEQQM7UPhutAotR+ED8tDcrILFjd36/WBtiu5fedGeqdwx X-Received: by 2002:a17:906:3b10:: with SMTP id g16mr32861025ejf.232.1622007086060; Tue, 25 May 2021 22:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622007086; cv=none; d=google.com; s=arc-20160816; b=bLrQHosErF6SjKdRuKTyxZV/uk76s9bWnaKlFPVkxLpSdDl3I6tMke8ZwnkUMWazUu kmYPeQH9xJ/QyRSMikPV4lb8zRXUz02m61UlhaIjrxspE0H6yLcyOpMeSVOEA7J/SbTT NNlj15D4O8Eqo9VJVhlKmPB66QKqryqFdZIiYjXN0HenAl46JoD4tkXEuxWVF8IGBJvP j6IWKteT7N4730dIFr6TE4pJQlqqJ79aCpc7JR90LxI2kTf+shTpVSEF01Xf2JgD/h/L wEfpw4IjvQj4M/JzcJGRLEMAUQNElnlDtP3SxLccKBnK+100yFJkb0R/Y2jvQ/xTNLwr peIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=dUaqe5ooj/3bNo6XBYYqy6v0GEoSXYJ7MyebHBms/88=; b=gZMlLxyoMv7Q86moT1Rms2chx6i6OjHs17IUrqTLsYgP6xvgnT0neW/rwTm2xfhneq xpf4FM56BwWAxctlVmvDvYpJdC8OhQ5bCFho4qCjJSt71qo1D/uF1XYjk/9MeIa9/U7W /sGin4Y7ZwdjG18yAe1lMghpUPS+XUOkeLjykaf03KkE/D2x00CfjQ09nluDCR7UXK2u KQUO3zN8RNRx9w0Ba8W3Zd1wUcqZFcnSBgZ4hB3ly89WdB5u0+n1eYRuNj3RVbweqA6d QqYNW4PZ7Vv9CPvErIAVM9i2oIL1CefqGTPdsmJTSWxpIPn42pyyhImp00DAmm6AHeCG GW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="XC/DW2AY"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si17573201edh.431.2021.05.25.22.31.01; Tue, 25 May 2021 22:31:26 -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; dkim=pass header.i=@chromium.org header.s=google header.b="XC/DW2AY"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232114AbhEZCeP (ORCPT + 99 others); Tue, 25 May 2021 22:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231961AbhEZCeO (ORCPT ); Tue, 25 May 2021 22:34:14 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5E42C061574 for ; Tue, 25 May 2021 19:32:43 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id i23-20020a9d68d70000b02902dc19ed4c15so30681681oto.0 for ; Tue, 25 May 2021 19:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=dUaqe5ooj/3bNo6XBYYqy6v0GEoSXYJ7MyebHBms/88=; b=XC/DW2AYPUyj9I8HZSfeH058rejqHpdwan/4THeH/RpGxK1Bx69kpaS3bb+er4ITmE 60eQ+P4e3MGiFxa9PmyC1rhO+6h6rqWqWC5cnRCsqErG8P9Ww7fDiLXqzjR9Bpchw8dn Ops4OLyj64FLFp0yJgGW75Cc2zR2JbJiDJlSs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=dUaqe5ooj/3bNo6XBYYqy6v0GEoSXYJ7MyebHBms/88=; b=mBrmainB1nLFQ/pZ295BXvsyDgJC9eQfO8Qym58Nou+Ks7olgd6cuEp+6MFkUzIAJ1 wWDM8UznKz/58hggUeiQbMoIytGVp1b9NjGKWCpUb9AQ/a/xPOQn0nn8jkKpjE3nMC0G a/XUQKJic3PAmHBPFWU1PBGO0GyJZJ8bKHZSqA1YmSYCQ1BcHpA9E8DNjR23UFUhZXC/ qm5TvW8TjdTt4x/e3DluJCRoS4GYT3w5YV546rx/OcyC3RINj31N+LFsqdSLH2oMRE5B MczLrT4qdT+NgXF06QmJMtXx9Emm8XX+iEZasQFW9s3+iYr1fX8HwNcrAYTih5iHIo3A M2Lg== X-Gm-Message-State: AOAM530kb8cy1cpzsbiVyTuzQ6x8oxj7gzPDza+Ssus1HrSu1WjGPWho OlWu7AEcDxm2glCPYxNYTGyxoEMpseQJc+YcYi7HSg== X-Received: by 2002:a05:6830:1556:: with SMTP id l22mr564426otp.34.1621996363093; Tue, 25 May 2021 19:32:43 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 25 May 2021 22:32:42 -0400 MIME-Version: 1.0 In-Reply-To: <858b8d14673a200c3c2162fb7a9bf891ecd2a2d9.camel@perches.com> References: <20210520013539.3733631-1-swboyd@chromium.org> <20210520013539.3733631-4-swboyd@chromium.org> <858b8d14673a200c3c2162fb7a9bf891ecd2a2d9.camel@perches.com> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Tue, 25 May 2021 22:32:42 -0400 Message-ID: Subject: Re: [PATCH 3/3] slub: Actually use 'message' in restore_bytes() To: David Rientjes , Joe Perches Cc: Andrew Morton , linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , Joonsoo Kim , Vlastimil Babka , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > --- > 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; > } > >