mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
Merge aa8e329172 ("Merge branch 'for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu") into android-mainline
Steps on the way to 5.12-rc1 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I812097f3da3553ee3570115b2926196168128bee
This commit is contained in:
commit
54b3c7d8a2
|
|
@ -210,6 +210,12 @@
|
|||
# define fallthrough do {} while (0) /* fallthrough */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#flatten
|
||||
*/
|
||||
# define __flatten __attribute__((flatten))
|
||||
|
||||
/*
|
||||
* Note the missing underscores.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2314,6 +2314,7 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
|
|||
|
||||
config TRIM_UNUSED_KSYMS
|
||||
bool "Trim unused exported kernel symbols"
|
||||
depends on BROKEN
|
||||
help
|
||||
The kernel and some modules make many symbols available for
|
||||
other modules to use via EXPORT_SYMBOL() and variants. Depending
|
||||
|
|
|
|||
36
mm/percpu.c
36
mm/percpu.c
|
|
@ -69,6 +69,7 @@
|
|||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/lcm.h>
|
||||
|
|
@ -2663,13 +2664,14 @@ early_param("percpu_alloc", percpu_alloc_setup);
|
|||
* On success, pointer to the new allocation_info is returned. On
|
||||
* failure, ERR_PTR value is returned.
|
||||
*/
|
||||
static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
|
||||
static struct pcpu_alloc_info * __init __flatten pcpu_build_alloc_info(
|
||||
size_t reserved_size, size_t dyn_size,
|
||||
size_t atom_size,
|
||||
pcpu_fc_cpu_distance_fn_t cpu_distance_fn)
|
||||
{
|
||||
static int group_map[NR_CPUS] __initdata;
|
||||
static int group_cnt[NR_CPUS] __initdata;
|
||||
static struct cpumask mask __initdata;
|
||||
const size_t static_size = __per_cpu_end - __per_cpu_start;
|
||||
int nr_groups = 1, nr_units = 0;
|
||||
size_t size_sum, min_unit_size, alloc_size;
|
||||
|
|
@ -2682,6 +2684,7 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
|
|||
/* this function may be called multiple times */
|
||||
memset(group_map, 0, sizeof(group_map));
|
||||
memset(group_cnt, 0, sizeof(group_cnt));
|
||||
cpumask_clear(&mask);
|
||||
|
||||
/* calculate size_sum and ensure dyn_size is enough for early alloc */
|
||||
size_sum = PFN_ALIGN(static_size + reserved_size +
|
||||
|
|
@ -2703,24 +2706,27 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
|
|||
upa--;
|
||||
max_upa = upa;
|
||||
|
||||
cpumask_copy(&mask, cpu_possible_mask);
|
||||
|
||||
/* group cpus according to their proximity */
|
||||
for_each_possible_cpu(cpu) {
|
||||
group = 0;
|
||||
next_group:
|
||||
for_each_possible_cpu(tcpu) {
|
||||
if (cpu == tcpu)
|
||||
break;
|
||||
if (group_map[tcpu] == group && cpu_distance_fn &&
|
||||
(cpu_distance_fn(cpu, tcpu) > LOCAL_DISTANCE ||
|
||||
cpu_distance_fn(tcpu, cpu) > LOCAL_DISTANCE)) {
|
||||
group++;
|
||||
nr_groups = max(nr_groups, group + 1);
|
||||
goto next_group;
|
||||
}
|
||||
}
|
||||
for (group = 0; !cpumask_empty(&mask); group++) {
|
||||
/* pop the group's first cpu */
|
||||
cpu = cpumask_first(&mask);
|
||||
group_map[cpu] = group;
|
||||
group_cnt[group]++;
|
||||
cpumask_clear_cpu(cpu, &mask);
|
||||
|
||||
for_each_cpu(tcpu, &mask) {
|
||||
if (!cpu_distance_fn ||
|
||||
(cpu_distance_fn(cpu, tcpu) == LOCAL_DISTANCE &&
|
||||
cpu_distance_fn(tcpu, cpu) == LOCAL_DISTANCE)) {
|
||||
group_map[tcpu] = group;
|
||||
group_cnt[group]++;
|
||||
cpumask_clear_cpu(tcpu, &mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
nr_groups = group;
|
||||
|
||||
/*
|
||||
* Wasted space is caused by a ratio imbalance of upa to group_cnt.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user