All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rich Felker <dalias@libc.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Rob Landley <rob@landley.net>,
	Matthew Wilcox <willy@infradead.org>,
	Linux-Arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] sh: remove unneeded constructor.
Date: Wed, 01 Aug 2018 20:13:26 +0900	[thread overview]
Message-ID: <87600us5k9.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <CAMuHMdUQReuzR=x54gnC1XdP77RrT1TaWoFFXUhUQ02A+giPqQ@mail.gmail.com>

On Wed, 01 Aug 2018 16:42:02 +0900,
Geert Uytterhoeven wrote:
> 
> Hi Sato-san,
> 
> CC Rob , Willy, linux-arch
> 
> On Tue, Jul 31, 2018 at 7:15 AM Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > pgd_cache specifies __GFP_ZERO when allocating.
> > This constructor is meaningless.
> >
> > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> 
> Thanks for your patch!
> 
> > --- a/arch/sh/mm/pgtable.c
> > +++ b/arch/sh/mm/pgtable.c
> > @@ -9,20 +9,11 @@ static struct kmem_cache *pgd_cachep;
> >  static struct kmem_cache *pmd_cachep;
> >  #endif
> >
> > -void pgd_ctor(void *x)
> > -{
> > -       pgd_t *pgd = x;
> > -
> > -       memcpy(pgd + USER_PTRS_PER_PGD,
> > -              swapper_pg_dir + USER_PTRS_PER_PGD,
> > -              (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
> > -}
> > -
> >  void pgtable_cache_init(void)
> >  {
> >         pgd_cachep = kmem_cache_create("pgd_cache",
> >                                        PTRS_PER_PGD * (1<<PTE_MAGNITUDE),
> > -                                      PAGE_SIZE, SLAB_PANIC, pgd_ctor);
> > +                                      PAGE_SIZE, SLAB_PANIC, NULL);
> >  #if PAGETABLE_LEVELS > 2
> >         pmd_cachep = kmem_cache_create("pmd_cache",
> >                                        PTRS_PER_PMD * (1<<PTE_MAGNITUDE),
> 
> While I can confirm your patch fixes the
> 
>     WARNING: CPU: 0 PID: 1 at mm/slub.c:2412
> ___slab_alloc.constprop.34+0x196/0x288
> 
> seen since commit 128227e7fe4087b6 ("slab: __GFP_ZERO is incompatible
> with a constructor"), I'm not 100% sure this is the correct fix.

I tried it in myself, but with this fix I will not get a warning.
I do not think that it is related.

> swapper_pg_dir[] does have two non-zero entries (768 and 895), which were
> copied by the constructor.  Perhaps SH does have a need for these two
> entries, and thus for the constructor?
> 
> Unfortunately I'm too SH-illiterate to answer this myself.

I have not tested enough to impose mm on my part, so it may be
by chance this too.
Restore the constructor and modify it so that __ GFP_ZERO is not specified.
Because then I think that it is safer because it is exactly the same as
before the fix.

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Yosinori Sato

WARNING: multiple messages have this Message-ID (diff)
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rich Felker <dalias@libc.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Rob Landley <rob@landley.net>,
	Matthew Wilcox <willy@infradead.org>,
	Linux-Arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] sh: remove unneeded constructor.
Date: Wed, 01 Aug 2018 11:13:26 +0000	[thread overview]
Message-ID: <87600us5k9.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <CAMuHMdUQReuzR=x54gnC1XdP77RrT1TaWoFFXUhUQ02A+giPqQ@mail.gmail.com>

On Wed, 01 Aug 2018 16:42:02 +0900,
Geert Uytterhoeven wrote:
> 
> Hi Sato-san,
> 
> CC Rob , Willy, linux-arch
> 
> On Tue, Jul 31, 2018 at 7:15 AM Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > pgd_cache specifies __GFP_ZERO when allocating.
> > This constructor is meaningless.
> >
> > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> 
> Thanks for your patch!
> 
> > --- a/arch/sh/mm/pgtable.c
> > +++ b/arch/sh/mm/pgtable.c
> > @@ -9,20 +9,11 @@ static struct kmem_cache *pgd_cachep;
> >  static struct kmem_cache *pmd_cachep;
> >  #endif
> >
> > -void pgd_ctor(void *x)
> > -{
> > -       pgd_t *pgd = x;
> > -
> > -       memcpy(pgd + USER_PTRS_PER_PGD,
> > -              swapper_pg_dir + USER_PTRS_PER_PGD,
> > -              (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
> > -}
> > -
> >  void pgtable_cache_init(void)
> >  {
> >         pgd_cachep = kmem_cache_create("pgd_cache",
> >                                        PTRS_PER_PGD * (1<<PTE_MAGNITUDE),
> > -                                      PAGE_SIZE, SLAB_PANIC, pgd_ctor);
> > +                                      PAGE_SIZE, SLAB_PANIC, NULL);
> >  #if PAGETABLE_LEVELS > 2
> >         pmd_cachep = kmem_cache_create("pmd_cache",
> >                                        PTRS_PER_PMD * (1<<PTE_MAGNITUDE),
> 
> While I can confirm your patch fixes the
> 
>     WARNING: CPU: 0 PID: 1 at mm/slub.c:2412
> ___slab_alloc.constprop.34+0x196/0x288
> 
> seen since commit 128227e7fe4087b6 ("slab: __GFP_ZERO is incompatible
> with a constructor"), I'm not 100% sure this is the correct fix.

I tried it in myself, but with this fix I will not get a warning.
I do not think that it is related.

> swapper_pg_dir[] does have two non-zero entries (768 and 895), which were
> copied by the constructor.  Perhaps SH does have a need for these two
> entries, and thus for the constructor?
> 
> Unfortunately I'm too SH-illiterate to answer this myself.

I have not tested enough to impose mm on my part, so it may be
by chance this too.
Restore the constructor and modify it so that __ GFP_ZERO is not specified.
Because then I think that it is safer because it is exactly the same as
before the fix.

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Yosinori Sato

  reply	other threads:[~2018-08-01 12:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  5:15 [PATCH] sh: remove unneeded constructor Yoshinori Sato
2018-08-01  7:42 ` Geert Uytterhoeven
2018-08-01  7:42   ` Geert Uytterhoeven
2018-08-01 11:13   ` Yoshinori Sato [this message]
2018-08-01 11:13     ` Yoshinori Sato
2018-08-04 10:35     ` Matthew Wilcox
2018-08-04 10:35       ` Matthew Wilcox
2018-08-04 10:47       ` Geert Uytterhoeven
2018-08-04 10:47         ` Geert Uytterhoeven
2018-08-04 10:51         ` Matthew Wilcox
2018-08-04 10:51           ` Matthew Wilcox
2018-08-05 15:54           ` Rob Landley
2018-08-05 15:54             ` Rob Landley
2018-08-05 16:32             ` Rich Felker
2018-08-05 16:32               ` Rich Felker
2018-08-05 22:48               ` Rob Landley
2018-08-05 22:48                 ` Rob Landley
2018-08-05 23:33                 ` Rich Felker
2018-08-05 23:33                   ` Rich Felker
2018-08-06  6:57                   ` Geert Uytterhoeven
2018-08-06  6:57                     ` Geert Uytterhoeven
2018-08-06  8:53                     ` Arnd Bergmann
2018-08-06  8:53                       ` Arnd Bergmann
2018-08-10 18:18                     ` Rob Landley
2018-08-10 18:18                       ` Rob Landley
2020-06-06 16:32           ` Rich Felker
2020-06-06 16:32             ` Rich Felker
2020-06-08 13:01             ` Matthew Wilcox
2020-06-08 13:01               ` Matthew Wilcox
2018-08-01 11:20   ` Matthew Wilcox
2018-08-01 11:20     ` Matthew Wilcox
2018-08-01 23:02     ` Rich Felker
2018-08-01 23:02       ` Rich Felker
2018-08-02  2:47       ` Matthew Wilcox
2018-08-02  2:47         ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87600us5k9.wl-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=dalias@libc.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.