On Fri, Oct 18, 2019 at 03:49:42PM +0300, Jarkko Sakkinen wrote: > On Wed, Oct 16, 2019 at 11:37:45AM -0700, Sean Christopherson wrote: > > Track the free page count on a per EPC section basis so that the value > > is properly protected by the section's spinlock. > > > > As was pointed out when the change was proposed[*], using a global > > non-atomic counter to track the number of free EPC pages is not safe. > > The order of non-atomic reads and writes are not guaranteed, i.e. > > concurrent RMW operats can write stale data. This causes a variety > > of bad behavior, e.g. livelocks because the free page count wraps and > > causes the swap thread to stop reclaiming. > > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > > What is the reason not change it just to atomic? > > For debugging the global is useful because it could be exposed > as a sysfs file. So the regression is that counter updates is read + store (was not btw described in the commit message what the regression you are speaking of, which means that I'm making a guess myself). This means that changing the variable to atomic should be IMHO sufficient. /Jarkko