Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1695248
| From | Dennis Zhou <dennisz@fb.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 09/23] percpu: combine percpu address checks |
| Date | 2017-07-25 01:10 +0200 |
| Message-ID | <u6UEb-3ig-43@gated-at.bofh.it> (permalink) |
| References | <u6UE9-3ig-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: "Dennis Zhou (Facebook)" <dennisszhou@gmail.com>
The percpu address checks for the reserved and dynamic region chunks are
now specific to each region. The address checking logic can be combined
taking advantage of the global references to the dynamic and static
region chunks.
Signed-off-by: Dennis Zhou <dennisszhou@gmail.com>
---
mm/percpu.c | 51 +++++++++++----------------------------------------
1 file changed, 11 insertions(+), 40 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 7c9f0d3..5b1fcef 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -182,52 +182,23 @@ static void pcpu_schedule_balance_work(void)
}
/**
- * pcpu_addr_in_first_chunk - address check for first chunk's dynamic region
- * @addr: percpu address of interest
- *
- * The first chunk is considered to be the dynamic region of the first chunk.
- * While the true first chunk is composed of the static, dynamic, and
- * reserved regions, it is the chunk that serves the dynamic region that is
- * circulated in the chunk slots.
- *
- * The reserved chunk has a separate check and the static region addresses
- * should never be passed into the percpu allocator.
- *
- * RETURNS:
- * True if the address is in the dynamic region of the first chunk.
- */
-static bool pcpu_addr_in_first_chunk(void *addr)
-{
- void *start_addr = pcpu_first_chunk->base_addr +
- pcpu_first_chunk->start_offset;
- void *end_addr = pcpu_first_chunk->base_addr +
- pcpu_first_chunk->nr_pages * PAGE_SIZE -
- pcpu_first_chunk->end_offset;
-
- return addr >= start_addr && addr < end_addr;
-}
-
-/**
- * pcpu_addr_in_reserved_chunk - address check for reserved region
- *
- * The reserved region is a part of the first chunk and primarily serves
- * static percpu variables from kernel modules.
+ * pcpu_addr_in_chunk - check if the address is served from this chunk
+ * @chunk: chunk of interest
+ * @addr: percpu address
*
* RETURNS:
- * True if the address is in the reserved region.
+ * True if the address is served from this chunk.
*/
-static bool pcpu_addr_in_reserved_chunk(void *addr)
+static bool pcpu_addr_in_chunk(struct pcpu_chunk *chunk, void *addr)
{
void *start_addr, *end_addr;
- if (!pcpu_reserved_chunk)
+ if (!chunk)
return false;
- start_addr = pcpu_reserved_chunk->base_addr +
- pcpu_reserved_chunk->start_offset;
- end_addr = pcpu_reserved_chunk->base_addr +
- pcpu_reserved_chunk->nr_pages * PAGE_SIZE -
- pcpu_reserved_chunk->end_offset;
+ start_addr = chunk->base_addr + chunk->start_offset;
+ end_addr = chunk->base_addr + chunk->nr_pages * PAGE_SIZE -
+ chunk->end_offset;
return addr >= start_addr && addr < end_addr;
}
@@ -929,11 +900,11 @@ static int __init pcpu_verify_alloc_info(const struct pcpu_alloc_info *ai);
static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
{
/* is it in the dynamic region (first chunk)? */
- if (pcpu_addr_in_first_chunk(addr))
+ if (pcpu_addr_in_chunk(pcpu_first_chunk, addr))
return pcpu_first_chunk;
/* is it in the reserved region? */
- if (pcpu_addr_in_reserved_chunk(addr))
+ if (pcpu_addr_in_chunk(pcpu_reserved_chunk, addr))
return pcpu_reserved_chunk;
/*
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/23] percpu: replace percpu area map allocator with bitmap allocator Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
[PATCH v2 22/23] percpu: update pcpu_find_block_fit to use an iterator Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 22/23] percpu: update pcpu_find_block_fit to use an iterator Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:50 +0200
[PATCH v2 09/23] percpu: combine percpu address checks Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 09/23] percpu: combine percpu address checks Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:30 +0200
[PATCH v2 02/23] percpu: introduce start_offset to pcpu_chunk Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 02/23] percpu: introduce start_offset to pcpu_chunk Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:10 +0200
[PATCH v2 13/23] percpu: generalize bitmap (un)populated iterators Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 13/23] percpu: generalize bitmap (un)populated iterators Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:40 +0200
Re: [PATCH v2 13/23] percpu: generalize bitmap (un)populated iterators Tejun Heo <tj@kernel.org> - 2017-07-26 16:10 +0200
[PATCH v2 08/23] percpu: modify base_addr to be region specific Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 08/23] percpu: modify base_addr to be region specific Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:30 +0200
[PATCH v2 17/23] percpu: skip chunks if the alloc does not fit in the contig hint Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 17/23] percpu: skip chunks if the alloc does not fit in the contig hint Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:50 +0200
[PATCH v2 19/23] percpu: update alloc path to only scan if contig hints are broken Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 19/23] percpu: update alloc path to only scan if contig hints are broken Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:40 +0200
[PATCH v2 12/23] percpu: increase minimum percpu allocation size and align first regions Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:10 +0200
Re: [PATCH v2 12/23] percpu: increase minimum percpu allocation size and align first regions Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:40 +0200
[PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic region must exist Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:20 +0200
Re: [PATCH v2 01/23] percpu: setup_first_chunk enforce dynamic region must exist Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:10 +0200
[PATCH v2 06/23] percpu: end chunk area maps page aligned for the populated bitmap Dennis Zhou <dennisz@fb.com> - 2017-07-25 01:20 +0200
Re: [PATCH v2 06/23] percpu: end chunk area maps page aligned for the populated bitmap Josef Bacik <josef@toxicpanda.com> - 2017-07-25 20:20 +0200
Re: [PATCH v2 14/23] percpu: replace area map allocator with bitmap allocator Josef Bacik <josef@toxicpanda.com> - 2017-07-25 21:20 +0200
csiph-web