All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zach O'Keefe" <zokeefe@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	kernel test robot <lkp@intel.com>,
	 Alex Shi <alex.shi@linux.alibaba.com>,
	David Hildenbrand <david@redhat.com>,
	 David Rientjes <rientjes@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	 Michal Hocko <mhocko@suse.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	 Peter Xu <peterx@redhat.com>,
	Rongwei Wang <rongwei.wang@linux.alibaba.com>,
	 SeongJae Park <sj@kernel.org>, Song Liu <songliubraving@fb.com>,
	Vlastimil Babka <vbabka@suse.cz>,  Zi Yan <ziy@nvidia.com>,
	Linux MM <linux-mm@kvack.org>,
	kbuild-all@lists.01.org,  Andrea Arcangeli <aarcange@redhat.com>,
	Arnd Bergmann <arnd@arndb.de>,
	 Axel Rasmussen <axelrasmussen@google.com>,
	Chris Kennelly <ckennelly@google.com>,
	 Chris Zankel <chris@zankel.net>, Helge Deller <deller@gmx.de>,
	Hugh Dickins <hughd@google.com>,
	 Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	 "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Jens Axboe <axboe@kernel.dk>,
	 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Matt Turner <mattst88@gmail.com>,
	 Max Filippov <jcmvbkbc@gmail.com>,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH v6 03/15] mm/khugepaged: add struct collapse_control
Date: Tue, 7 Jun 2022 18:06:51 -0700	[thread overview]
Message-ID: <CAAa6QmQXn9odA-dsm-FFKqQmDvBuH0qDkmPFfXDS1so+Loe+4Q@mail.gmail.com> (raw)
In-Reply-To: <CAHbLzkqf-1rGs9jTwrarR4ZtifJuDKVA40fMBSxFHdnUkSZHdQ@mail.gmail.com>

On Tue, Jun 7, 2022 at 6:00 PM Yang Shi <shy828301@gmail.com> wrote:
>
> On Tue, Jun 7, 2022 at 5:43 PM Zach O'Keefe <zokeefe@google.com> wrote:
> >
> > On Mon, Jun 6, 2022 at 4:54 PM Yang Shi <shy828301@gmail.com> wrote:
> > >
> > > On Mon, Jun 6, 2022 at 3:23 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> > > >
> > > > On Mon, 6 Jun 2022 09:40:20 -0700 "Zach O'Keefe" <zokeefe@google.com> wrote:
> > > >
> > > > > On Sun, Jun 5, 2022 at 7:42 PM kernel test robot <lkp@intel.com> wrote:
> > > > > >
> > > > > > Hi Zach,
> > > > > >
> > > > > > Thank you for the patch! Perhaps something to improve:
> > > > > >
> > > > > > [auto build test WARNING on akpm-mm/mm-everything]
> > > > > >
> > > > > > url:    https://github.com/intel-lab-lkp/linux/commits/Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953
> > > > > > base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > > > > config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20220606/202206060911.I8rRqGwC-lkp@intel.com/config)
> > > > > > compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
> > > > > > reproduce (this is a W=1 build):
> > > > > >         # https://github.com/intel-lab-lkp/linux/commit/d87b6065d6050b89930cca0814921aca7c269286
> > > > > >         git remote add linux-review https://github.com/intel-lab-lkp/linux
> > > > > >         git fetch --no-tags linux-review Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953
> > > > > >         git checkout d87b6065d6050b89930cca0814921aca7c269286
> > > > > >         # save the config file
> > > > > >         mkdir build_dir && cp config build_dir/.config
> > > > > >         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > > > >
> > > > > > If you fix the issue, kindly add following tag where applicable
> > > > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > > >
> > > > > > All warnings (new ones prefixed by >>):
> > > > > >
> > > > > >    mm/khugepaged.c: In function 'khugepaged':
> > > > > > >> mm/khugepaged.c:2284:1: warning: the frame size of 4160 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> > > > > >     2284 | }
> > > > > >          | ^
> > > > >
> > > > > Thanks lkp@intel.com.
> > > > >
> > > > > This is due to config with:
> > > > >
> > > > > CONFIG_FRAME_WARN=2048
> > > > > CONFIG_NODES_SHIFT=10
> > > > >
> > > > > Where struct collapse_control has a member int
> > > > > node_load[MAX_NUMNODES], and we stack allocate one.
> > > > >
> > > > > Is this a configuration that needs to be supported? 1024 nodes seems
> > > > > like a lot and I'm not sure if these configs are randomly generated or
> > > > > are reminiscent of real systems.
> > > >
> > > > Adding 4k to the stack isn't a good thing to do.  It's trivial to
> > > > kmalloc the thing, so why not do that?
> > >
> > > Thanks, Andrew. Yeah, I just suggested that too.
> >
> > Thanks Yang / Andrew for taking the time to voice your suggestions.
> >
> > I'll go ahead and just kmalloc() the thing and fail if we can't.
> >
> > Yang, is there a reason to kmalloc() the entire struct
> > collapse_control with trailing flex array vs stack allocating the
> > struct collapse_control + kmalloc()'ing the node_load array?
>
> I don't think those two have too much difference. I don't have a
> strong preference personally. However you could choose:
>
> Define collapse_control as:
> struct collapse_control {
>     xxx;
>     ...
>     int node_load[MAX_NUMANODES];
> }
> Then you could kmalloc the whole struct.
>
> Or it could be defined as:
> struct collapse_control {
>     xxx;
>     ...
>     int *node_load[];
> }
> In this way you could allocate collapse_control on stack or by
> kmalloc, then kmalloc node_load for all possible nodes instead of
> MAX_NUMANODES. This may have a better success rate since you do
> kmalloc much less memory (typically the number of possible nodes is
> much less than MAX_NUMANODES), but it may be not worth it since the
> error handling path is more complicated and it may not make too much
> difference.
>
> The first choice is definitely much simpler, you may want to try that first.

Thanks for the suggestion. First approach also has the benefit of
being able to statically allocate one for khugepaged and simplifies
error paths there. I'll try that.

Again, thanks for taking the time to review and help out / suggest
improvements :)

Best,
Zach

> >
> >
> > > >
> > > > I'll await some reviewer input (hopefully positive ;)) before merging
> > > > this series.


WARNING: multiple messages have this Message-ID (diff)
From: Zach O'Keefe <zokeefe@google.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v6 03/15] mm/khugepaged: add struct collapse_control
Date: Tue, 07 Jun 2022 18:06:51 -0700	[thread overview]
Message-ID: <CAAa6QmQXn9odA-dsm-FFKqQmDvBuH0qDkmPFfXDS1so+Loe+4Q@mail.gmail.com> (raw)
In-Reply-To: <CAHbLzkqf-1rGs9jTwrarR4ZtifJuDKVA40fMBSxFHdnUkSZHdQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4606 bytes --]

On Tue, Jun 7, 2022 at 6:00 PM Yang Shi <shy828301@gmail.com> wrote:
>
> On Tue, Jun 7, 2022 at 5:43 PM Zach O'Keefe <zokeefe@google.com> wrote:
> >
> > On Mon, Jun 6, 2022 at 4:54 PM Yang Shi <shy828301@gmail.com> wrote:
> > >
> > > On Mon, Jun 6, 2022 at 3:23 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> > > >
> > > > On Mon, 6 Jun 2022 09:40:20 -0700 "Zach O'Keefe" <zokeefe@google.com> wrote:
> > > >
> > > > > On Sun, Jun 5, 2022 at 7:42 PM kernel test robot <lkp@intel.com> wrote:
> > > > > >
> > > > > > Hi Zach,
> > > > > >
> > > > > > Thank you for the patch! Perhaps something to improve:
> > > > > >
> > > > > > [auto build test WARNING on akpm-mm/mm-everything]
> > > > > >
> > > > > > url:    https://github.com/intel-lab-lkp/linux/commits/Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953
> > > > > > base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > > > > config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20220606/202206060911.I8rRqGwC-lkp(a)intel.com/config)
> > > > > > compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
> > > > > > reproduce (this is a W=1 build):
> > > > > >         # https://github.com/intel-lab-lkp/linux/commit/d87b6065d6050b89930cca0814921aca7c269286
> > > > > >         git remote add linux-review https://github.com/intel-lab-lkp/linux
> > > > > >         git fetch --no-tags linux-review Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953
> > > > > >         git checkout d87b6065d6050b89930cca0814921aca7c269286
> > > > > >         # save the config file
> > > > > >         mkdir build_dir && cp config build_dir/.config
> > > > > >         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> > > > > >
> > > > > > If you fix the issue, kindly add following tag where applicable
> > > > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > > >
> > > > > > All warnings (new ones prefixed by >>):
> > > > > >
> > > > > >    mm/khugepaged.c: In function 'khugepaged':
> > > > > > >> mm/khugepaged.c:2284:1: warning: the frame size of 4160 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> > > > > >     2284 | }
> > > > > >          | ^
> > > > >
> > > > > Thanks lkp(a)intel.com.
> > > > >
> > > > > This is due to config with:
> > > > >
> > > > > CONFIG_FRAME_WARN=2048
> > > > > CONFIG_NODES_SHIFT=10
> > > > >
> > > > > Where struct collapse_control has a member int
> > > > > node_load[MAX_NUMNODES], and we stack allocate one.
> > > > >
> > > > > Is this a configuration that needs to be supported? 1024 nodes seems
> > > > > like a lot and I'm not sure if these configs are randomly generated or
> > > > > are reminiscent of real systems.
> > > >
> > > > Adding 4k to the stack isn't a good thing to do.  It's trivial to
> > > > kmalloc the thing, so why not do that?
> > >
> > > Thanks, Andrew. Yeah, I just suggested that too.
> >
> > Thanks Yang / Andrew for taking the time to voice your suggestions.
> >
> > I'll go ahead and just kmalloc() the thing and fail if we can't.
> >
> > Yang, is there a reason to kmalloc() the entire struct
> > collapse_control with trailing flex array vs stack allocating the
> > struct collapse_control + kmalloc()'ing the node_load array?
>
> I don't think those two have too much difference. I don't have a
> strong preference personally. However you could choose:
>
> Define collapse_control as:
> struct collapse_control {
>     xxx;
>     ...
>     int node_load[MAX_NUMANODES];
> }
> Then you could kmalloc the whole struct.
>
> Or it could be defined as:
> struct collapse_control {
>     xxx;
>     ...
>     int *node_load[];
> }
> In this way you could allocate collapse_control on stack or by
> kmalloc, then kmalloc node_load for all possible nodes instead of
> MAX_NUMANODES. This may have a better success rate since you do
> kmalloc much less memory (typically the number of possible nodes is
> much less than MAX_NUMANODES), but it may be not worth it since the
> error handling path is more complicated and it may not make too much
> difference.
>
> The first choice is definitely much simpler, you may want to try that first.

Thanks for the suggestion. First approach also has the benefit of
being able to statically allocate one for khugepaged and simplifies
error paths there. I'll try that.

Again, thanks for taking the time to review and help out / suggest
improvements :)

Best,
Zach

> >
> >
> > > >
> > > > I'll await some reviewer input (hopefully positive ;)) before merging
> > > > this series.

  reply	other threads:[~2022-06-08  1:07 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04  0:39 [PATCH v6 00/15] mm: userspace hugepage collapse Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 01/15] mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA Zach O'Keefe
2022-06-06 18:25   ` Yang Shi
2022-06-29 20:49   ` Peter Xu
2022-06-30  1:15     ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 02/15] mm/khugepaged: record SCAN_PMD_MAPPED when scan_pmd() finds THP Zach O'Keefe
2022-06-06 20:45   ` Yang Shi
2022-06-07 16:01     ` Zach O'Keefe
2022-06-07 19:32       ` Zach O'Keefe
2022-06-07 21:27         ` Yang Shi
2022-06-08  0:27           ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 03/15] mm/khugepaged: add struct collapse_control Zach O'Keefe
2022-06-06  2:41   ` kernel test robot
2022-06-06 16:40     ` Zach O'Keefe
2022-06-06 16:40       ` Zach O'Keefe
2022-06-06 20:20       ` Yang Shi
2022-06-06 20:20         ` Yang Shi
2022-06-06 21:22         ` Yang Shi
2022-06-06 21:22           ` Yang Shi
2022-06-06 22:23       ` Andrew Morton
2022-06-06 22:23         ` Andrew Morton
2022-06-06 23:53         ` Yang Shi
2022-06-06 23:53           ` Yang Shi
2022-06-08  0:42           ` Zach O'Keefe
2022-06-08  0:42             ` Zach O'Keefe
2022-06-08  1:00             ` Yang Shi
2022-06-08  1:00               ` Yang Shi
2022-06-08  1:06               ` Zach O'Keefe [this message]
2022-06-08  1:06                 ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 04/15] mm/khugepaged: dedup and simplify hugepage alloc and charging Zach O'Keefe
2022-06-06 20:50   ` Yang Shi
2022-06-29 21:58   ` Peter Xu
2022-06-30 20:14     ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 05/15] mm/khugepaged: make allocation semantics context-specific Zach O'Keefe
2022-06-06 20:58   ` Yang Shi
2022-06-07 19:56     ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 06/15] mm/khugepaged: pipe enum scan_result codes back to callers Zach O'Keefe
2022-06-06 22:39   ` Yang Shi
2022-06-07  0:17     ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 07/15] mm/khugepaged: add flag to ignore khugepaged heuristics Zach O'Keefe
2022-06-06 22:51   ` Yang Shi
2022-06-04  0:39 ` [PATCH v6 08/15] mm/khugepaged: add flag to ignore THP sysfs enabled Zach O'Keefe
2022-06-06 23:02   ` Yang Shi
     [not found]   ` <YrzehlUoo2iMMLC2@xz-m1.local>
     [not found]     ` <CAAa6QmRXD5KboM8=ZZRPThOmcLEPtxzf0XyjkCeY_vgR7VOPqg@mail.gmail.com>
2022-06-30  2:32       ` Peter Xu
2022-06-30 14:17         ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 09/15] mm/madvise: introduce MADV_COLLAPSE sync hugepage collapse Zach O'Keefe
2022-06-06 23:53   ` Yang Shi
2022-06-07 22:48     ` Zach O'Keefe
2022-06-08  0:39       ` Yang Shi
2022-06-09 17:35         ` Zach O'Keefe
2022-06-09 18:51           ` Yang Shi
2022-06-10 14:51             ` Zach O'Keefe
2022-06-04  0:39 ` [PATCH v6 10/15] mm/khugepaged: rename prefix of shared collapse functions Zach O'Keefe
2022-06-06 23:56   ` Yang Shi
2022-06-07  0:31     ` Zach O'Keefe
2022-06-04  0:40 ` [PATCH v6 11/15] mm/madvise: add MADV_COLLAPSE to process_madvise() Zach O'Keefe
2022-06-07 19:14   ` Yang Shi
2022-06-04  0:40 ` [PATCH v6 12/15] selftests/vm: modularize collapse selftests Zach O'Keefe
2022-06-04  0:40 ` [PATCH v6 13/15] selftests/vm: add MADV_COLLAPSE collapse context to selftests Zach O'Keefe
2022-06-04  0:40 ` [PATCH v6 14/15] selftests/vm: add selftest to verify recollapse of THPs Zach O'Keefe
2022-06-04  0:40 ` [PATCH v6 15/15] tools headers uapi: add MADV_COLLAPSE madvise mode to tools Zach O'Keefe
2022-06-06 23:58   ` Yang Shi
2022-06-07  0:24     ` Zach O'Keefe

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=CAAa6QmQXn9odA-dsm-FFKqQmDvBuH0qDkmPFfXDS1so+Loe+4Q@mail.gmail.com \
    --to=zokeefe@google.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=axelrasmussen@google.com \
    --cc=chris@zankel.net \
    --cc=ckennelly@google.com \
    --cc=david@redhat.com \
    --cc=deller@gmx.de \
    --cc=hughd@google.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jcmvbkbc@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mattst88@gmail.com \
    --cc=mhocko@suse.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterx@redhat.com \
    --cc=rientjes@google.com \
    --cc=rongwei.wang@linux.alibaba.com \
    --cc=shy828301@gmail.com \
    --cc=sj@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.com \
    /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.