Skip to content

Commit

Permalink
lib/show_mem.c: drop pgdat_resize_lock in show_mem()
Browse files Browse the repository at this point in the history
Function show_mem() is used to print system memory status when user
requires or fail to allocate memory.  Generally, this is a best effort
information so any races with memory hotplug (or very theoretically an
early initialization) should be tolerable and the worst that could happen
is to print an imprecise node state.

Drop the resize lock because this is the only place which might hold the
lock from the interrupt context and so all other callers might use a
simple spinlock.  Even though this doesn't solve any real issue it makes
the code easier to follow and tiny more effective.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Wei Yang <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
RichardWeiYang authored and torvalds committed Dec 28, 2018
1 parent 0ecea99 commit c3a5c77
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/show_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
show_free_areas(filter, nodemask);

for_each_online_pgdat(pgdat) {
unsigned long flags;
int zoneid;

pgdat_resize_lock(pgdat, &flags);
for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
struct zone *zone = &pgdat->node_zones[zoneid];
if (!populated_zone(zone))
Expand All @@ -33,7 +31,6 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
if (is_highmem_idx(zoneid))
highmem += zone->present_pages;
}
pgdat_resize_unlock(pgdat, &flags);
}

printk("%lu pages RAM\n", total);
Expand Down

0 comments on commit c3a5c77

Please sign in to comment.