CHROMIUM: verity: use alloc_page instead of mempool_alloc
authorMandeep Singh Baines <msb@chromium.org>
Fri, 22 Jul 2011 15:48:48 +0000 (08:48 -0700)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 06:59:42 +0000 (23:59 -0700)
commit55178acc967196b8035508958c3c93662562f0eb
treee23457b0dc919d8aff7902ae5bc34c50078b9a99
parent9ec9319bd3583f1e74a504f374dc250e5d016fd5
CHROMIUM: verity: use alloc_page instead of mempool_alloc

I ran a quick test and verified that mempool_alloc we are never
hitting the remove_element path of mempool_alloc so the 8MB of
mempool memory is never actually used.

Since dm-verity is read-only, its not part of memory reclaim. So a
memory pool is not neccesary. Since we alloc with GFP_KERNEL, an
allocation failure is highly unlikely. If an allocation does fail,
we already have code to handle the failure.

By removing the memory pool, we save 8 MB of RAM and save 1 ms on boot:

[    0.974280] before mempool_create_page_pool
[    0.975345] after mempool_create_page_pool

BUG=chromium-os:9752
TEST=Ran dm-verity.git unit tests. Ran platform_DMVerityCorruption on H/W.

Also ran platform_BootPerfServer:

Before:

  seconds_power_on_to_login                                       8.81
  seconds_power_on_to_login{1}                                    8.76
  seconds_power_on_to_login{2}                                    9.24
  seconds_power_on_to_login{3}                                    8.83
  seconds_power_on_to_login{4}                                    8.76
  seconds_power_on_to_login{5}                                    8.84
  seconds_power_on_to_login{6}                                    8.86
  seconds_power_on_to_login{7}                                    8.86
  seconds_power_on_to_login{8}                                    8.86
  seconds_power_on_to_login{9}                                    8.97

  Mean:  8.87
  Stdev: 0.14

After:

  seconds_power_on_to_login                                       8.92
  seconds_power_on_to_login{1}                                    9.06
  seconds_power_on_to_login{2}                                    8.96
  seconds_power_on_to_login{3}                                    8.71
  seconds_power_on_to_login{4}                                    8.99
  seconds_power_on_to_login{5}                                    8.89
  seconds_power_on_to_login{6}                                    8.77
  seconds_power_on_to_login{7}                                    8.96
  seconds_power_on_to_login{8}                                    8.95
  seconds_power_on_to_login{9}                                    8.95

  Mean: 8.91
  Stdev 0.10

The difference between the two runs is within stdev.

Change-Id: I9eddf2f01e6d3f09a010622d09485fac0924a8db
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/4584
drivers/md/dm-bht.c
include/linux/dm-bht.h