Commit 2c0300e7 authored by Lee Jones's avatar Lee Jones
Browse files

ANDROID: af_unix: Allocate memory for the largest possible size of 'struct scm_fp_list'



In order to work around some fairly intrusive ABI infringements, we have
2 choices.  Either create a whole new structure to wrap around 'struct
scm_fp_list' or push all of the new field entries to the bottom of the
existing struct.

Initially we opted for the first choice, since this seemed to save a
substantial amount of memory (~500KB) due to the kmemdup() magic found
in scm_fp_dup().  However, this required some far reaching adaptions to
the current code, meaning that the chances of conflicts in the future
would have been significant and maintenance costs would have remained
high.

However, it turns out that each block of 2KB that is allocated in
scm_fp_dup() is not accumulative and only exists for a short amount of
time before being subsequently freed.  Thus, the hit taken with respect
to the extra memory used by simply allocating the largest possible size
of the struct is now considered to be a good trade-off.  So let's do
that.

Bug: 404256079
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: Id8fc8dd01deae75d87dce16f46a59ff67cac0832
(cherry picked from commit f972f2d7)
parent b5eef27a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment