[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/percpu: Misc cleanup
commit 09ed69f66d5799cd70f38e458b56a6a65dbead1f Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Aug 18 13:24:41 2017 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Aug 30 11:03:08 2017 +0100 x86/percpu: Misc cleanup * Drop unnecessary brackets. * Add spaces around binary operators. * Insert appropriate blank lines. * Insert a local variable block at the end. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/percpu.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c index 1d3bc2e..c9997b7 100644 --- a/xen/arch/x86/percpu.c +++ b/xen/arch/x86/percpu.c @@ -13,11 +13,12 @@ unsigned long __per_cpu_offset[NR_CPUS]; * context of PV guests. */ #define INVALID_PERCPU_AREA (0x8000000000000000L - (long)__per_cpu_start) -#define PERCPU_ORDER (get_order_from_bytes(__per_cpu_data_end-__per_cpu_start)) +#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start) void __init percpu_init_areas(void) { unsigned int cpu; + for ( cpu = 1; cpu < NR_CPUS; cpu++ ) __per_cpu_offset[cpu] = INVALID_PERCPU_AREA; } @@ -25,12 +26,16 @@ void __init percpu_init_areas(void) static int init_percpu_area(unsigned int cpu) { char *p; + if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA ) return -EBUSY; + if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL ) return -ENOMEM; + memset(p, 0, __per_cpu_data_end - __per_cpu_start); __per_cpu_offset[cpu] = p - __per_cpu_start; + return 0; } @@ -45,6 +50,7 @@ static void _free_percpu_area(struct rcu_head *head) struct free_info *info = container_of(head, struct free_info, rcu); unsigned int cpu = info->cpu; char *p = __per_cpu_start + __per_cpu_offset[cpu]; + free_xenheap_pages(p, PERCPU_ORDER); __per_cpu_offset[cpu] = INVALID_PERCPU_AREA; } @@ -52,6 +58,7 @@ static void _free_percpu_area(struct rcu_head *head) static void free_percpu_area(unsigned int cpu) { struct free_info *info = &per_cpu(free_info, cpu); + info->cpu = cpu; call_rcu(&info->rcu, _free_percpu_area); } @@ -86,6 +93,16 @@ static struct notifier_block cpu_percpu_nfb = { static int __init percpu_presmp_init(void) { register_cpu_notifier(&cpu_percpu_nfb); + return 0; } presmp_initcall(percpu_presmp_init); + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |