Re: [PATCH] memory hotplug disable boot option

Nathan Fontenot
2010-07-01T03:17:43Z

On 06/30/2010 07:31 PM, KAMEZAWA Hiroyuki wrote:
> On Wed, 30 Jun 2010 08:47:55 -0700
> Greg KH <gregkh@suse.de> wrote:
>>> and adding a scalable interface for large scale machines ?
>>> I'd like to consider something..
>>
>> Dynamically changing the layout on big memory boxes makes sense to me,
>> how about you?
>>
>
> like this ?
> ==
> boot option:
> memory_sysfs_layout=compact
> memory_sysfs_layout=auto (default)
> memory_sysfs_layout=full
>
> Considering briefly, how about this compact layout ?
>
> /sys/devices/system/memory/:
> list, hide, show, memoryX...
>
> list: // show available memory index list.
> #cat list
> 0 1 2 ....10000...
>
> show: //an interface to enable the interface.
> #echo INDEX > memory_index
> will create memoryINDEX diretory.
>
> hide: //an interface to hide the interface.
> #echo INDEX > memory_hide
> will remove memoryINDEX sysfs directory.
>
>
> In compact mode, all memoryX interface are hidden at boot.
> In full mode, all memoryX interaface are shown.
> The Boot option just affects status at boot. If users want, he can make
> all memory sysfs in shown state.

Do we need to make something as complicated as dynamically adding and removing
the sysfs directories? Why not a compact layout that just takes the files
that currently reside in the memoryXX dirs and move them up to the memory
directory. This would be state (which should probably be split into an
'online' and 'offline' file), removable, phys_index, and phys_device.

Doing a cat on each of these files would simply report the appropriate
information for all of the memory sections present. We could even go
as far storing the online status and removable status as a bitmap instead
of putting it in the memory_block struct and use th in-kernel routines
for printing bitmaps.

Users could then do memory hotplug by echo'ing the memory section to
online to the 'online' file, and echo'ing the section number to the
'offline' file to offline a section.

In this mode ew would skip the creation of all of the sysfs nodes and
completely remove the performance issue seen.

Since this new layout and possible mdification to the memory_block
structure would not easily allow switching between he different layouts,
perhaps this should be set via a config option.

-Nathan