Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-15 Thread Dave Hansen
On 04/14/2018 07:19 PM, Baoquan He wrote: >>> Yes, this place is the hardest to understand. The temorary arrays are >>> allocated beforehand with the size of 'nr_present_sections'. The error >>> paths you mentioned is caused by allocation failure of mem_map or >>> map_map, but whatever it's error

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-15 Thread Dave Hansen
On 04/14/2018 07:19 PM, Baoquan He wrote: >>> Yes, this place is the hardest to understand. The temorary arrays are >>> allocated beforehand with the size of 'nr_present_sections'. The error >>> paths you mentioned is caused by allocation failure of mem_map or >>> map_map, but whatever it's error

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-14 Thread Baoquan He
Hi Dave, Sorry for late reply. On 04/11/18 at 08:48am, Dave Hansen wrote: > On 04/08/2018 01:20 AM, Baoquan He wrote: > > On 04/06/18 at 07:50am, Dave Hansen wrote: > >> The code looks fine to me. It's a bit of a shame that there's no > >> verification to ensure that idx_present never goes

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-14 Thread Baoquan He
Hi Dave, Sorry for late reply. On 04/11/18 at 08:48am, Dave Hansen wrote: > On 04/08/2018 01:20 AM, Baoquan He wrote: > > On 04/06/18 at 07:50am, Dave Hansen wrote: > >> The code looks fine to me. It's a bit of a shame that there's no > >> verification to ensure that idx_present never goes

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-11 Thread Dave Hansen
On 04/08/2018 01:20 AM, Baoquan He wrote: > On 04/06/18 at 07:50am, Dave Hansen wrote: >> The code looks fine to me. It's a bit of a shame that there's no >> verification to ensure that idx_present never goes beyond the shiny new >> nr_present_sections. > > This is a good point. Do you think

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-11 Thread Dave Hansen
On 04/08/2018 01:20 AM, Baoquan He wrote: > On 04/06/18 at 07:50am, Dave Hansen wrote: >> The code looks fine to me. It's a bit of a shame that there's no >> verification to ensure that idx_present never goes beyond the shiny new >> nr_present_sections. > > This is a good point. Do you think

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-08 Thread Baoquan He
On 04/08/18 at 04:20pm, Baoquan He wrote: > On 04/06/18 at 07:50am, Dave Hansen wrote: > > I'm having a really hard time tying all the pieces back together. Let > > me give it a shot and you can tell me where I go wrong. > > > > On 02/27/2018 07:26 PM, Baoquan He wrote: > > > In sparse_init(),

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-08 Thread Baoquan He
On 04/08/18 at 04:20pm, Baoquan He wrote: > On 04/06/18 at 07:50am, Dave Hansen wrote: > > I'm having a really hard time tying all the pieces back together. Let > > me give it a shot and you can tell me where I go wrong. > > > > On 02/27/2018 07:26 PM, Baoquan He wrote: > > > In sparse_init(),

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-08 Thread Baoquan He
On 04/06/18 at 07:50am, Dave Hansen wrote: > I'm having a really hard time tying all the pieces back together. Let > me give it a shot and you can tell me where I go wrong. > > On 02/27/2018 07:26 PM, Baoquan He wrote: > > In sparse_init(), two temporary pointer arrays, usemap_map and map_map >

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-08 Thread Baoquan He
On 04/06/18 at 07:50am, Dave Hansen wrote: > I'm having a really hard time tying all the pieces back together. Let > me give it a shot and you can tell me where I go wrong. > > On 02/27/2018 07:26 PM, Baoquan He wrote: > > In sparse_init(), two temporary pointer arrays, usemap_map and map_map >

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-06 Thread Dave Hansen
I'm having a really hard time tying all the pieces back together. Let me give it a shot and you can tell me where I go wrong. On 02/27/2018 07:26 PM, Baoquan He wrote: > In sparse_init(), two temporary pointer arrays, usemap_map and map_map > are allocated with the size of NR_MEM_SECTIONS. In

Re: [PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-04-06 Thread Dave Hansen
I'm having a really hard time tying all the pieces back together. Let me give it a shot and you can tell me where I go wrong. On 02/27/2018 07:26 PM, Baoquan He wrote: > In sparse_init(), two temporary pointer arrays, usemap_map and map_map > are allocated with the size of NR_MEM_SECTIONS. In

[PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-02-27 Thread Baoquan He
In sparse_init(), two temporary pointer arrays, usemap_map and map_map are allocated with the size of NR_MEM_SECTIONS. They are used to store each memory section's usemap and mem map if marked as present. With the help of these two arrays, continuous memory chunk is allocated for usemap and memmap

[PATCH v3 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-02-27 Thread Baoquan He
In sparse_init(), two temporary pointer arrays, usemap_map and map_map are allocated with the size of NR_MEM_SECTIONS. They are used to store each memory section's usemap and mem map if marked as present. With the help of these two arrays, continuous memory chunk is allocated for usemap and memmap