Skip to content

Commit 699ae62

Browse files
mjguzikmimizohar
authored andcommitted
evm: stop avoidably reading i_writecount in evm_file_release
The EVM_NEW_FILE flag is unset if the file already existed at the time of open and this can be checked without looking at i_writecount. Not accessing it reduces traffic on the cacheline during parallel open of the same file and drop the evm_file_release routine from second place to bottom of the profile. Fixes: 75a323e ("evm: Make it independent from 'integrity' LSM") Signed-off-by: Mateusz Guzik <[email protected]> Reviewed-by: Roberto Sassu <[email protected]> Cc: [email protected] # 6.9+ Signed-off-by: Mimi Zohar <[email protected]>
1 parent 923168a commit 699ae62

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/integrity/evm/evm_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,8 @@ static void evm_file_release(struct file *file)
10841084
if (!S_ISREG(inode->i_mode) || !(mode & FMODE_WRITE))
10851085
return;
10861086

1087-
if (iint && atomic_read(&inode->i_writecount) == 1)
1087+
if (iint && iint->flags & EVM_NEW_FILE &&
1088+
atomic_read(&inode->i_writecount) == 1)
10881089
iint->flags &= ~EVM_NEW_FILE;
10891090
}
10901091

0 commit comments

Comments
 (0)