On Tue 27-11-18 17:20:05, Oscar Salvador wrote: > From: Oscar Salvador <osalvador@xxxxxxxx> > > shrink_zone_span and shrink_pgdat_span look a bit weird. > > They both have a loop at the end to check if the zone > or pgdat contains only holes in case the section to be removed > was not either the first one or the last one. > > Both code loops look quite similar, so we can simplify it a bit. > We do that by creating a function (has_only_holes), that basically > calls find_smallest_section_pfn() with the full range. > In case nothing has to be found, we do not have any more sections > there. > > To be honest, I am not really sure we even need to go through this > check in case we are removing a middle section, because from what I can see, > we will always have a first/last section. > > Taking the chance, we could also simplify both find_smallest_section_pfn() > and find_biggest_section_pfn() functions and move the common code > to a helper. I didn't get to read through this whole series but one thing that is on my todo list for a long time is to remove all this stuff. I do not think we really want to simplify it when there shouldn't be any real reason to have it around at all. Why do we need to shrink zone/node at all? Now that we can override and assign memory to both normal na movable zones I think we should be good to remove shrinking. -- Michal Hocko SUSE Labs