From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Thu, 31 Jan 2019 10:04:18 -0500 (EST) Subject: [Cluster-devel] [PATCH 2/2] gfs2: Fix lru_count going negative In-Reply-To: <1247235469.68837763.1548945397399.JavaMail.zimbra@redhat.com> References: <20190131105543.15421-1-ross.lagerwall@citrix.com> <20190131105543.15421-3-ross.lagerwall@citrix.com> <1247235469.68837763.1548945397399.JavaMail.zimbra@redhat.com> Message-ID: <359471440.68850881.1548947058822.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > > + > > + if (!test_bit(GLF_LRU, &gl->gl_flags)) { > > + set_bit(GLF_LRU, &gl->gl_flags); > > atomic_inc(&lru_count); > > + } > > The above may be simplified to something like: > + if (!test_and_set_bit(GLF_LRU, &gl->gl_flags)) > atomic_inc(&lru_count); Scratch that. Andreas says test_and_set_bit() and similar are much more expensive cpu-wise, and we're already protected from races by the lru_lock, so I guess the original is better after all. Bob Peterson