mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 17:30:53 +07:00
selinux: avoid unnecessary avc cache stat hit count
There is no point in counting hits - we can calculate it from the number of lookups and misses. This makes the avc statistics a bit smaller, and makes the code generation better too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
044aea9b83
commit
257313b2a8
@ -343,11 +343,10 @@ static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass)
|
|||||||
node = avc_search_node(ssid, tsid, tclass);
|
node = avc_search_node(ssid, tsid, tclass);
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
avc_cache_stats_incr(hits);
|
return node;
|
||||||
else
|
|
||||||
avc_cache_stats_incr(misses);
|
|
||||||
|
|
||||||
return node;
|
avc_cache_stats_incr(misses);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int avc_latest_notif_update(int seqno, int is_insert)
|
static int avc_latest_notif_update(int seqno, int is_insert)
|
||||||
@ -765,7 +764,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
|
|||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
|
||||||
node = avc_lookup(ssid, tsid, tclass);
|
node = avc_lookup(ssid, tsid, tclass);
|
||||||
if (!node) {
|
if (unlikely(!node)) {
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (in_avd)
|
if (in_avd)
|
||||||
|
@ -41,7 +41,6 @@ struct sk_buff;
|
|||||||
*/
|
*/
|
||||||
struct avc_cache_stats {
|
struct avc_cache_stats {
|
||||||
unsigned int lookups;
|
unsigned int lookups;
|
||||||
unsigned int hits;
|
|
||||||
unsigned int misses;
|
unsigned int misses;
|
||||||
unsigned int allocations;
|
unsigned int allocations;
|
||||||
unsigned int reclaims;
|
unsigned int reclaims;
|
||||||
|
@ -1380,10 +1380,14 @@ static int sel_avc_stats_seq_show(struct seq_file *seq, void *v)
|
|||||||
if (v == SEQ_START_TOKEN)
|
if (v == SEQ_START_TOKEN)
|
||||||
seq_printf(seq, "lookups hits misses allocations reclaims "
|
seq_printf(seq, "lookups hits misses allocations reclaims "
|
||||||
"frees\n");
|
"frees\n");
|
||||||
else
|
else {
|
||||||
seq_printf(seq, "%u %u %u %u %u %u\n", st->lookups,
|
unsigned int lookups = st->lookups;
|
||||||
st->hits, st->misses, st->allocations,
|
unsigned int misses = st->misses;
|
||||||
|
unsigned int hits = lookups - misses;
|
||||||
|
seq_printf(seq, "%u %u %u %u %u %u\n", lookups,
|
||||||
|
hits, misses, st->allocations,
|
||||||
st->reclaims, st->frees);
|
st->reclaims, st->frees);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user