On Jun 19, 2012 8:30 PM, "Dan Magenheimer" wrote: > > Zcache (in staging) has a large number of read-only counters that > are primarily of interest to developers. These counters are currently > visible from sysfs. However sysfs is not really appropriate and > zcache will need to switch to debugfs before it can be promoted > out of staging. > > For some of the counters, it is critical that they remain accurate so > an atomic_t must be used. But AFAICT there is no way for debugfs > to work with atomic_t. Which ones must be atomic? Do they really need to be atomic if they are for diagnostics/developers? > > Is that correct? Or am I missing something? > > Assuming it is correct, I have a workaround but it is ugly: > > static unsigned long counterX; > static atomic_t atomic_counterX; > > counterX = atomic_*_return(atomic_counterX) > > and use atomic_counter in normal code and counter for debugfs. > > This works but requires each counter to be stored twice AND > makes the code look ugly. But only for those counters that truly must be atomic. > > Is there a better way? I can probably bury the ugliness in > macros but that doesn't solve the duplicate storage. (Though > since there are only about a dozen, maybe it doesn't matter?) A dozen that _MUST_ be atomic? > > Thanks, > Dan > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: