On Thu, 11 Sep 2014, Leon Romanovsky wrote: > >> I think the better way will be to apply Mel's patch > >> https://lkml.org/lkml/2014/9/8/214 which fix zone_page_state shadow casting > >> issue and convert all atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH])) to > >> zone_page__state(zone, NR_ALLOC_BATCH). This move will unify access to > >> vm_stat. > > > > It's not as simple. The counter can go way negative and we need that > > negative number, not 0, to calculate the reset delta. As I said in > > response to Mel's patch, we could make the vmstat API signed but I'm > > not convinced that is reasonable, given the 99% majority of usecases. > You are right, I missed that NR_ALLOC_BATCH is in use as a part of > calculations > + high_wmark_pages(zone) - low_wmark_pages(zone) - > + atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH]));
How about creating __zone_page_state for zone_page_state without the 0 check? That would be much nicer and would move the stuff to a central place. Given the nastiness of this issue there are bound to be more fixes coming up. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/