diff options
author | Tony Luck <tony.luck@intel.com> | 2006-03-21 08:22:56 -0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-03-21 08:22:56 -0800 |
commit | 133a58c1fd97022690d53dd58df56579193cbc1d (patch) | |
tree | 34e304eaf545cd7991580a7a30609f49c919eb52 /arch/ia64/sn/kernel/xpc_partition.c | |
parent | dc5cdd8ec146a60152f2264c8fe920ca5ecc71ea (diff) | |
parent | 7aa6ba41362a7f888ad11fdcfe51ca8d92226cd3 (diff) | |
download | talos-op-linux-133a58c1fd97022690d53dd58df56579193cbc1d.tar.gz talos-op-linux-133a58c1fd97022690d53dd58df56579193cbc1d.zip |
Pull sn2-reduce-kmalloc-wrap into release branch
Diffstat (limited to 'arch/ia64/sn/kernel/xpc_partition.c')
-rw-r--r-- | arch/ia64/sn/kernel/xpc_partition.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c index 88a730e6cfdb..94211429fd0c 100644 --- a/arch/ia64/sn/kernel/xpc_partition.c +++ b/arch/ia64/sn/kernel/xpc_partition.c @@ -81,6 +81,31 @@ char ____cacheline_aligned xpc_remote_copy_buffer[XPC_RP_HEADER_SIZE + /* + * Guarantee that the kmalloc'd memory is cacheline aligned. + */ +static void * +xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base) +{ + /* see if kmalloc will give us cachline aligned memory by default */ + *base = kmalloc(size, flags); + if (*base == NULL) { + return NULL; + } + if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) { + return *base; + } + kfree(*base); + + /* nope, we'll have to do it ourselves */ + *base = kmalloc(size + L1_CACHE_BYTES, flags); + if (*base == NULL) { + return NULL; + } + return (void *) L1_CACHE_ALIGN((u64) *base); +} + + +/* * Given a nasid, get the physical address of the partition's reserved page * for that nasid. This function returns 0 on any error. */ @@ -1038,13 +1063,12 @@ xpc_discovery(void) remote_vars = (struct xpc_vars *) remote_rp; - discovered_nasids = kmalloc(sizeof(u64) * xp_nasid_mask_words, + discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words, GFP_KERNEL); if (discovered_nasids == NULL) { kfree(remote_rp_base); return; } - memset(discovered_nasids, 0, sizeof(u64) * xp_nasid_mask_words); rp = (struct xpc_rsvd_page *) xpc_rsvd_page; |