mm/shmem.c: fix unlikely() test of info->seals to test only for WRITE and GROW
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 24 Feb 2017 22:59:10 +0000 (14:59 -0800)
committerDanny Wood <danwood76@gmail.com>
Thu, 28 Jan 2021 09:32:01 +0000 (09:32 +0000)
commit931225a2c76bb00cdf1041318447d53c318bf55c
treeca16fd1abc285ad43a5d081a134426b1c463a516
parent964c67e5b012aa9f4617d70bd75b56233cfbd528
mm/shmem.c: fix unlikely() test of info->seals to test only for WRITE and GROW

Running my likely/unlikely profiler, I discovered that the test in
shmem_write_begin() that tests for info->seals as unlikely, is always
incorrect.  This is because shmem_get_inode() sets info->seals to have
F_SEAL_SEAL set by default, and it is unlikely to be cleared when
shmem_write_begin() is called.  Thus, the if statement is very likely.

But as the if statement block only cares about F_SEAL_WRITE and
F_SEAL_GROW, change the test to only test those two bits.

Link: http://lkml.kernel.org/r/20170203105656.7aec6237@gandalf.local.home
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: I83b8fc6ebae581486df16842713ba83a37e3b858
mm/shmem.c