On 28.04.2011 17:51, Stefan Assmann wrote: > On 04/28/2011 05:08 PM, Andi Kleen wrote: >>> You're right, logging every page marked would be too verbose. That's why >>> I wrapped that logging into pr_debug. >> >> pr_debug still floods the kernel log buffer. On large systems >> it often already overflows. > > That's a pain then, I understand. I took a closer look at pr_debug and it seems that pr_debug gets evaluated to a conditional branch and thus does not flood the log buffer if not explicitly enabled. I confirmed that by dumping the log buffer. So in the normal use-case things should be fine and if pr_debug really is enabled it dumps a lot of data, which I hope is acceptable for debugging purposes. > >> >>> However I kept the printk in the case of early allocated pages. The user >>> should be notified of the attempt to mark a page that's already been >>> allocated by the kernel itself. >> >> That's ok, although if you're unlucky (e.g. hit a large mem_map area) >> it can be also very nosiy. >> >> It would be better if you fixed the printks to output ranges. > > BadRAM patterns might often mark non-consecutive pages so outputting > ranges could be more verbose than what we have now. I'll try to think > of something to minimize log output. How about the following: static int __init badram_mark_pages(unsigned long addr, unsigned long mask) { unsigned long pagecount = 0, is_reserved = 0; [...] printk(KERN_INFO "BadRAM: mark 0x%lx with mask 0x%0lx\n", addr, mask); do { [...] if (memblock_is_reserved(addr)) { pr_debug("BadRAM: page %lu reserved by kernel\n", pfn); is_reserved++; continue; } [...] pr_debug("BadRAM: page %lu (addr 0x%0lx) marked bad " "[total %lu]\n", pfn, addr, pagecount); } while (next_masked_address(&addr, mask)); if (is_reserved) printk(KERN_WARNING "BadRAM: %lu page(s) already reserved and " "could not be marked bad\n", is_reserved); return pagecount; } This way everything with possibly high volume log output is guarded by pr_debug and only the summary gets printed by default. No log_buf cluttering but also a bit harder to debug for somebody who's interested in finding out which pages are already reserved. Stefan -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>