Skip to content

Commit

Permalink
percpu: add __read_mostly to variables which are mostly read only
Browse files Browse the repository at this point in the history
Most global variables in percpu allocator are initialized during boot
and read only from that point on.  Add __read_mostly as per Rusty's
suggestion.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Tejun Heo committed Feb 24, 2009
1 parent 8ac8375 commit 40150d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ struct pcpu_chunk {
struct page *page[]; /* #cpus * UNIT_PAGES */
};

static int pcpu_unit_pages;
static int pcpu_unit_size;
static int pcpu_chunk_size;
static int pcpu_nr_slots;
static size_t pcpu_chunk_struct_size;
static int pcpu_unit_pages __read_mostly;
static int pcpu_unit_size __read_mostly;
static int pcpu_chunk_size __read_mostly;
static int pcpu_nr_slots __read_mostly;
static size_t pcpu_chunk_struct_size __read_mostly;

/* the address of the first chunk which starts with the kernel static area */
void *pcpu_base_addr;
void *pcpu_base_addr __read_mostly;
EXPORT_SYMBOL_GPL(pcpu_base_addr);

/* the size of kernel static area */
static int pcpu_static_size;
static int pcpu_static_size __read_mostly;

/*
* One mutex to rule them all.
Expand All @@ -112,7 +112,7 @@ static int pcpu_static_size;
*/
static DEFINE_MUTEX(pcpu_mutex);

static struct list_head *pcpu_slot; /* chunk list slots */
static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */
static struct rb_root pcpu_addr_root = RB_ROOT; /* chunks by address */

static int __pcpu_size_to_slot(int size)
Expand Down

0 comments on commit 40150d3

Please sign in to comment.