Skip to content

Commit

Permalink
stress-ng: rename stress_get_pagesize to stress_get_page_size
Browse files Browse the repository at this point in the history
Simple rename to align with page_size = stress_get_page_size()
idoim.

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Mar 30, 2022
1 parent 85c0f50 commit dab3543
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions core-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ size_t stress_mk_filename(
}

/*
* stress_get_pagesize()
* get pagesize
* stress_get_page_size()
* get page_size
*/
size_t stress_get_pagesize(void)
size_t stress_get_page_size(void)
{
static size_t page_size = 0;

Expand Down Expand Up @@ -451,7 +451,7 @@ uint64_t stress_get_phys_mem_size(void)
{
#if defined(STRESS_SC_PAGES)
uint64_t phys_pages = 0;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
const uint64_t max_pages = ~0ULL / page_size;

phys_pages = (uint64_t)sysconf(STRESS_SC_PAGES);
Expand Down Expand Up @@ -1239,7 +1239,7 @@ void pr_yaml_runinfo(FILE *yaml)
pr_yaml(yaml, " freeswap: %lu\n", info.freeswap);
}
#endif
pr_yaml(yaml, " pagesize: %zd\n", stress_get_pagesize());
pr_yaml(yaml, " pagesize: %zd\n", stress_get_page_size());
pr_yaml(yaml, " cpus: %" PRId32 "\n", stress_get_processors_configured());
pr_yaml(yaml, " cpus-online: %" PRId32 "\n", stress_get_processors_online());
pr_yaml(yaml, " ticks-per-second: %" PRId32 "\n", stress_get_ticks_per_second());
Expand Down Expand Up @@ -1875,7 +1875,7 @@ size_t stress_probe_max_pipe_size(void)
return max_pipe_size;

#if defined(F_SETPIPE_SZ)
page_size = stress_get_pagesize();
page_size = stress_get_page_size();

/*
* Try and find maximum pipe size directly
Expand Down Expand Up @@ -1908,7 +1908,7 @@ size_t stress_probe_max_pipe_size(void)
ret:
max_pipe_size = sz;
#else
max_pipe_size = stress_get_pagesize();
max_pipe_size = stress_get_page_size();
#endif
return max_pipe_size;
}
Expand Down
2 changes: 1 addition & 1 deletion core-madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void stress_madvise_pid_all_pages(const pid_t pid, const int advise)
* Readable protection? read pages
*/
if ((prot[0] == 'r') && (path[0] != '[')) {
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

volatile uint8_t *ptr = (volatile uint8_t *)start;

Expand Down
2 changes: 1 addition & 1 deletion core-mincore.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int stress_mincore_touch_pages_generic(
const size_t buf_len,
const bool interruptible)
{
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
const size_t n_pages = buf_len / page_size;

#if !defined(HAVE_MINCORE)
Expand Down
2 changes: 1 addition & 1 deletion core-mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
int stress_mlock_region(const void *addr_start, const void *addr_end)
{
#if defined(HAVE_MLOCK)
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
const void *m_addr_start =
(void *)((uintptr_t)addr_start & ~(page_size - 1));
const void *m_addr_end =
Expand Down
2 changes: 1 addition & 1 deletion core-thrash.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static int stress_pagein_proc(const pid_t pid)
char buffer[4096];
int fdmem, rc = 0;
FILE *fpmap;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

if ((pid == parent_pid) || (pid == getpid()))
return 0;
Expand Down
4 changes: 2 additions & 2 deletions stress-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ static void stress_dev_random_linux(
static void stress_dev_mem_mmap_linux(const int fd, const bool read_page)
{
void *ptr;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

ptr = mmap(NULL, page_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (ptr != MAP_FAILED) {
Expand Down Expand Up @@ -2985,7 +2985,7 @@ static void stress_dev_port_linux(
{
off_t off;
uint8_t *ptr;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

(void)args;
(void)devpath;
Expand Down
8 changes: 4 additions & 4 deletions stress-ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ static void MLOCKED_TEXT stress_run(
{
double time_start, time_finish;
int32_t started_instances = 0;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

wait_flag = true;
time_start = stress_time_now();
Expand Down Expand Up @@ -2697,7 +2697,7 @@ static void *stress_map_page(int prot, char *prot_str, size_t page_size)
*/
static inline void stress_shared_map(const int32_t num_procs)
{
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
size_t len = sizeof(stress_shared_t) +
(sizeof(stress_stats_t) * (size_t)num_procs);
size_t sz = (len + (page_size << 1)) & ~(page_size - 1);
Expand Down Expand Up @@ -2797,7 +2797,7 @@ static inline void stress_shared_map(const int32_t num_procs)
*/
void stress_shared_unmap(void)
{
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();

(void)munmap((void *)g_shared->mapped.page_wo, page_size);
(void)munmap((void *)g_shared->mapped.page_ro, page_size);
Expand Down Expand Up @@ -3539,7 +3539,7 @@ int main(int argc, char **argv, char **envp)
stressors_tail = NULL;
stress_mwc_reseed();

(void)stress_get_pagesize();
(void)stress_get_page_size();
stressor_set_defaults();
g_pgrp = getpid();

Expand Down
2 changes: 1 addition & 1 deletion stress-ng.h
Original file line number Diff line number Diff line change
Expand Up @@ -2680,7 +2680,7 @@ extern WARN_UNUSED size_t stress_min_pthread_stack_size(void);
extern void stress_shared_unmap(void);
extern void stress_log_system_mem_info(void);
extern WARN_UNUSED char *stress_munge_underscore(const char *str);
extern size_t stress_get_pagesize(void);
extern size_t stress_get_page_size(void);
extern WARN_UNUSED int32_t stress_get_processors_online(void);
extern WARN_UNUSED int32_t stress_get_processors_configured(void);
extern WARN_UNUSED int32_t stress_get_ticks_per_second(void);
Expand Down
2 changes: 1 addition & 1 deletion stress-pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int stress_set_pipe_data_size(const char *opt)

pipe_data_size = (size_t)stress_get_uint64_byte(opt);
stress_check_range_bytes("pipe-data-size", pipe_data_size,
4, stress_get_pagesize());
4, stress_get_page_size());
return stress_set_setting("pipe-data-size,", TYPE_ID_SIZE_T, &pipe_data_size);
}

Expand Down
2 changes: 1 addition & 1 deletion stress-ramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static volatile bool keep_mounting = true;
static int stress_set_ramfs_size(const char *opt)
{
uint64_t ramfs_size;
const uint64_t page_size = (uint64_t)stress_get_pagesize();
const uint64_t page_size = (uint64_t)stress_get_page_size();
const uint64_t page_mask = ~(page_size - 1);

ramfs_size = stress_get_uint64_byte(opt);
Expand Down
4 changes: 2 additions & 2 deletions stress-sparsematrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ static int stress_sparse_method_test(

static void *mmap_create(const uint32_t n, const uint32_t x, const uint32_t y)
{
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
static sparse_mmap_t m;
size_t shmall, freemem, totalmem, freeswap, max_phys;

Expand Down Expand Up @@ -969,7 +969,7 @@ static void *mmap_create(const uint32_t n, const uint32_t x, const uint32_t y)
static void mmap_destroy(void *handle, size_t *objmem)
{
sparse_mmap_t *m = (sparse_mmap_t *)handle;
const size_t page_size = stress_get_pagesize();
const size_t page_size = stress_get_page_size();
unsigned char *vec;
size_t pages;

Expand Down

0 comments on commit dab3543

Please sign in to comment.