Re: [PATCH 1/5] mm/sparse: check size of struct mm_section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> >> >> In order to fully utilize the memory chunk allocated from bootmem
>> >> >> allocator, it'd better to assure memory sector descriptor won't run
>> >> >> across the boundary (PAGE_SIZE).
>> >
>> >OK, I misread this part of the changelog changelog.
>> >
>> 
>> I should have clarified that more clear :-)
>> 
>> >> >
>> >> >Why? The memory is continuous, right?
>> >> 
>> >> Yes, the memory is conginous and the capacity of specific entry
>> >> in mem_section[NR_SECTION_ROOTS] has been defined as follows:
>> >> 
>> >> 
>> >> #define SECTIONS_PER_ROOT       (PAGE_SIZE / sizeof (struct mem_section))
>> >> 
>> >> Also, the memory is prone to be allocated from bootmem by function
>> >> alloc_bootmem_node(), which has PAGE_SIZE alignment. So I think it's
>> >> reasonable to introduce the extra check here from my personal view :-)
>> >
>> >No it is not necessary because we will never cross the page boundary
>> >because (SECTIONS_PER_ROOT uses an int division)
>> 
>> Current situation is that we don't cross the page foundary, but somebody
>> else might change the data struct (struct mem_section) in future. 
>
>No, this is safe even if the structure size changes (unless it is bigger
>than PAGE_SIZE).

Yeah, but it can't fully utilize the allocated memory chunk if the size of
the struct isn't aligned well.

Let me drop it in next revision :-)

Thanks,
Gavin


>-- 
>Michal Hocko
>SUSE Labs
>SUSE LINUX s.r.o.
>Lihovarska 1060/12
>190 00 Praha 9    
>Czech Republic
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]