]> git.baikalelectronics.ru Git - kernel.git/commit
mm: Use fixed constant in page_frag_alloc instead of size + 1
authorAlexander Duyck <alexander.h.duyck@linux.intel.com>
Fri, 15 Feb 2019 22:44:12 +0000 (14:44 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Feb 2019 23:48:43 +0000 (15:48 -0800)
commit56f0688d4d9f0269bad56952468a4c87d18654e7
treeea32aa83dd30a3cb7491dc2d33c55971b00ce363
parent1408f554d947aa1dd6d8f4e721ee984fd31c31db
mm: Use fixed constant in page_frag_alloc instead of size + 1

This patch replaces the size + 1 value introduced with the recent fix for 1
byte allocs with a constant value.

The idea here is to reduce code overhead as the previous logic would have
to read size into a register, then increment it, and write it back to
whatever field was being used. By using a constant we can avoid those
memory reads and arithmetic operations in favor of just encoding the
maximum value into the operation itself.

Fixes: 82bec6ae0e97 ("mm: page_alloc: fix ref bias in page_frag_alloc() for 1-byte allocs")
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
mm/page_alloc.c