On Mon, Aug 27, 2018 at 10:13:49AM +0800, Baoquan He wrote: >On 08/07/18 at 02:49pm, Chao Fan wrote: >> If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory >> tables, store the immovable memory regions, so that kaslr can get >> the information abouth where can be selected or not. >> If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code. >Just adjust the patch log a little bit, just for your reference. > >If 'CONFIG_MEMORY_HOTREMOVE' specified, walk through the acpi srat memory >tables and store those immovable memory regions so that kaslr can get >where to choose for randomization.
OK, I will change more patch log in next version. > >> [...] >> +#ifdef CONFIG_MEMORY_HOTREMOVE >> +/* >> + * According to ACPI table, filter the immvoable memory regions >> + * and store them in immovable_mem[]. >> + */ >> +static void handle_immovable_mem(void) > >Can we change this function like below, passed in the immovable_mem and >the array lengty, the value of num_immovable_mem will be passed back? > >static void handle_immovable_mem(char* region, int max, int *num) >{ >} > >Like this, you don't need patch 1/4 to make a header file, just put this >function handle_immovable_mem() into acpitb.c since it's handling acpi >tables. And its name can be get_immovable_mem(). That makes sense. But if we change like this, we can put the whole function to acpitb.c. It will be like: static void handle_immovable_mem(int *num) { } Because the value of immovable_mem is filled in handle_immovable_mem, it's better to put immovable_mem in acpitb.c also, then extern in kaslr.c. Thanks, Chao Fan