diff options
author | Manish Ahuja <ahuja@austin.ibm.com> | 2008-03-21 19:47:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-03-25 17:44:07 -0400 |
commit | fd35cff8d285c6ae30c66a70321ebbcd2a4615ec (patch) | |
tree | 1067d04b1f9553f585434c1091f980b90b5cf0c3 /arch/powerpc/platforms | |
parent | a9c508dae10a821dc95653178eec018abc90482e (diff) |
[POWERPC] pseries: phyp dump: Tracking memory range freed
This tracks the size freed. For now it does a simple rudimentary
calculation of the ranges freed. The idea is to keep it simple at the
external shell script level and send in large chunks for now.
Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/phyp_dump.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index df4870ec90d8..034fe1b54dd9 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c | |||
@@ -261,6 +261,39 @@ static void release_memory_range(unsigned long start_pfn, | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | /** | ||
265 | * track_freed_range -- Counts the range being freed. | ||
266 | * Once the counter goes to zero, it re-registers dump for | ||
267 | * future use. | ||
268 | */ | ||
269 | static void | ||
270 | track_freed_range(unsigned long addr, unsigned long length) | ||
271 | { | ||
272 | static unsigned long scratch_area_size, reserved_area_size; | ||
273 | |||
274 | if (addr < phyp_dump_info->init_reserve_start) | ||
275 | return; | ||
276 | |||
277 | if ((addr >= phyp_dump_info->init_reserve_start) && | ||
278 | (addr <= phyp_dump_info->init_reserve_start + | ||
279 | phyp_dump_info->init_reserve_size)) | ||
280 | reserved_area_size += length; | ||
281 | |||
282 | if ((addr >= phyp_dump_info->reserved_scratch_addr) && | ||
283 | (addr <= phyp_dump_info->reserved_scratch_addr + | ||
284 | phyp_dump_info->reserved_scratch_size)) | ||
285 | scratch_area_size += length; | ||
286 | |||
287 | if ((reserved_area_size == phyp_dump_info->init_reserve_size) && | ||
288 | (scratch_area_size == phyp_dump_info->reserved_scratch_size)) { | ||
289 | |||
290 | invalidate_last_dump(&phdr, | ||
291 | phyp_dump_info->reserved_scratch_addr); | ||
292 | register_dump_area(&phdr, | ||
293 | phyp_dump_info->reserved_scratch_addr); | ||
294 | } | ||
295 | } | ||
296 | |||
264 | /* ------------------------------------------------- */ | 297 | /* ------------------------------------------------- */ |
265 | /** | 298 | /** |
266 | * sysfs_release_region -- sysfs interface to release memory range. | 299 | * sysfs_release_region -- sysfs interface to release memory range. |
@@ -285,6 +318,8 @@ static ssize_t store_release_region(struct kobject *kobj, | |||
285 | if (ret != 2) | 318 | if (ret != 2) |
286 | return -EINVAL; | 319 | return -EINVAL; |
287 | 320 | ||
321 | track_freed_range(start_addr, length); | ||
322 | |||
288 | /* Range-check - don't free any reserved memory that | 323 | /* Range-check - don't free any reserved memory that |
289 | * wasn't reserved for phyp-dump */ | 324 | * wasn't reserved for phyp-dump */ |
290 | if (start_addr < phyp_dump_info->init_reserve_start) | 325 | if (start_addr < phyp_dump_info->init_reserve_start) |