Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Andrew Morton
On Fri, 13 Jul 2018 09:24:44 -0400 Pavel Tatashin wrote: > On 07/13/2018 09:17 AM, Oscar Salvador wrote: > > On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: > >> +static void *sparsemap_buf __meminitdata; > >> +static void *sparsemap_buf_end __meminitdata; > >> + > >> +void

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Andrew Morton
On Fri, 13 Jul 2018 09:24:44 -0400 Pavel Tatashin wrote: > On 07/13/2018 09:17 AM, Oscar Salvador wrote: > > On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: > >> +static void *sparsemap_buf __meminitdata; > >> +static void *sparsemap_buf_end __meminitdata; > >> + > >> +void

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Pavel Tatashin
On 07/13/2018 09:17 AM, Oscar Salvador wrote: > On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: >> +static void *sparsemap_buf __meminitdata; >> +static void *sparsemap_buf_end __meminitdata; >> + >> +void __init sparse_buffer_init(unsigned long size, int nid) >> +{ >> +

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Pavel Tatashin
On 07/13/2018 09:17 AM, Oscar Salvador wrote: > On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: >> +static void *sparsemap_buf __meminitdata; >> +static void *sparsemap_buf_end __meminitdata; >> + >> +void __init sparse_buffer_init(unsigned long size, int nid) >> +{ >> +

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Oscar Salvador
On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: > +static void *sparsemap_buf __meminitdata; > +static void *sparsemap_buf_end __meminitdata; > + > +void __init sparse_buffer_init(unsigned long size, int nid) > +{ > + BUG_ON(sparsemap_buf); Why do we need a BUG_ON() here?

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-13 Thread Oscar Salvador
On Thu, Jul 12, 2018 at 04:37:26PM -0400, Pavel Tatashin wrote: > +static void *sparsemap_buf __meminitdata; > +static void *sparsemap_buf_end __meminitdata; > + > +void __init sparse_buffer_init(unsigned long size, int nid) > +{ > + BUG_ON(sparsemap_buf); Why do we need a BUG_ON() here?

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-12 Thread Andrew Morton
On Thu, 12 Jul 2018 16:37:26 -0400 Pavel Tatashin wrote: > When struct pages are allocated for sparse-vmemmap VA layout, we first > try to allocate one large buffer, and than if that fails allocate struct > pages for each section as we go. > > The code that allocates buffer is uses global

Re: [PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-12 Thread Andrew Morton
On Thu, 12 Jul 2018 16:37:26 -0400 Pavel Tatashin wrote: > When struct pages are allocated for sparse-vmemmap VA layout, we first > try to allocate one large buffer, and than if that fails allocate struct > pages for each section as we go. > > The code that allocates buffer is uses global

[PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-12 Thread Pavel Tatashin
When struct pages are allocated for sparse-vmemmap VA layout, we first try to allocate one large buffer, and than if that fails allocate struct pages for each section as we go. The code that allocates buffer is uses global variables and is spread across several call sites. Cleanup the code by

[PATCH v5 1/5] mm/sparse: abstract sparse buffer allocations

2018-07-12 Thread Pavel Tatashin
When struct pages are allocated for sparse-vmemmap VA layout, we first try to allocate one large buffer, and than if that fails allocate struct pages for each section as we go. The code that allocates buffer is uses global variables and is spread across several call sites. Cleanup the code by