Commit 6689bed3 authored by Qiujun Huang's avatar Qiujun Huang Committed by Steven Rostedt (VMware)

ring-buffer: Remove cpu_buffer argument from the rb_inc_page()

The cpu_buffer argument is not used inside the rb_inc_page() after
commit 3adc54fa ("ring-buffer: make the buffer a true circular link
list").
And cpu_buffer argument is not used inside the two functions too,
rb_is_head_page/rb_set_list_to_head.

Link: https://lkml.kernel.org/r/20201225140356.23008-1-hqjagain@gmail.comSigned-off-by: default avatarQiujun Huang <hqjagain@gmail.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 18d14ebd
...@@ -1112,8 +1112,7 @@ static struct list_head *rb_list_head(struct list_head *list) ...@@ -1112,8 +1112,7 @@ static struct list_head *rb_list_head(struct list_head *list)
* its flags will be non zero. * its flags will be non zero.
*/ */
static inline int static inline int
rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer, rb_is_head_page(struct buffer_page *page, struct list_head *list)
struct buffer_page *page, struct list_head *list)
{ {
unsigned long val; unsigned long val;
...@@ -1142,8 +1141,7 @@ static bool rb_is_reader_page(struct buffer_page *page) ...@@ -1142,8 +1141,7 @@ static bool rb_is_reader_page(struct buffer_page *page)
/* /*
* rb_set_list_to_head - set a list_head to be pointing to head. * rb_set_list_to_head - set a list_head to be pointing to head.
*/ */
static void rb_set_list_to_head(struct ring_buffer_per_cpu *cpu_buffer, static void rb_set_list_to_head(struct list_head *list)
struct list_head *list)
{ {
unsigned long *ptr; unsigned long *ptr;
...@@ -1166,7 +1164,7 @@ static void rb_head_page_activate(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -1166,7 +1164,7 @@ static void rb_head_page_activate(struct ring_buffer_per_cpu *cpu_buffer)
/* /*
* Set the previous list pointer to have the HEAD flag. * Set the previous list pointer to have the HEAD flag.
*/ */
rb_set_list_to_head(cpu_buffer, head->list.prev); rb_set_list_to_head(head->list.prev);
} }
static void rb_list_head_clear(struct list_head *list) static void rb_list_head_clear(struct list_head *list)
...@@ -1241,8 +1239,7 @@ static int rb_head_page_set_normal(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -1241,8 +1239,7 @@ static int rb_head_page_set_normal(struct ring_buffer_per_cpu *cpu_buffer,
old_flag, RB_PAGE_NORMAL); old_flag, RB_PAGE_NORMAL);
} }
static inline void rb_inc_page(struct ring_buffer_per_cpu *cpu_buffer, static inline void rb_inc_page(struct buffer_page **bpage)
struct buffer_page **bpage)
{ {
struct list_head *p = rb_list_head((*bpage)->list.next); struct list_head *p = rb_list_head((*bpage)->list.next);
...@@ -1274,11 +1271,11 @@ rb_set_head_page(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -1274,11 +1271,11 @@ rb_set_head_page(struct ring_buffer_per_cpu *cpu_buffer)
*/ */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
do { do {
if (rb_is_head_page(cpu_buffer, page, page->list.prev)) { if (rb_is_head_page(page, page->list.prev)) {
cpu_buffer->head_page = page; cpu_buffer->head_page = page;
return page; return page;
} }
rb_inc_page(cpu_buffer, &page); rb_inc_page(&page);
} while (page != head); } while (page != head);
} }
...@@ -1824,7 +1821,7 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages) ...@@ -1824,7 +1821,7 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
cond_resched(); cond_resched();
to_remove_page = tmp_iter_page; to_remove_page = tmp_iter_page;
rb_inc_page(cpu_buffer, &tmp_iter_page); rb_inc_page(&tmp_iter_page);
/* update the counters */ /* update the counters */
page_entries = rb_page_entries(to_remove_page); page_entries = rb_page_entries(to_remove_page);
...@@ -2271,7 +2268,7 @@ static void rb_inc_iter(struct ring_buffer_iter *iter) ...@@ -2271,7 +2268,7 @@ static void rb_inc_iter(struct ring_buffer_iter *iter)
if (iter->head_page == cpu_buffer->reader_page) if (iter->head_page == cpu_buffer->reader_page)
iter->head_page = rb_set_head_page(cpu_buffer); iter->head_page = rb_set_head_page(cpu_buffer);
else else
rb_inc_page(cpu_buffer, &iter->head_page); rb_inc_page(&iter->head_page);
iter->page_stamp = iter->read_stamp = iter->head_page->page->time_stamp; iter->page_stamp = iter->read_stamp = iter->head_page->page->time_stamp;
iter->head = 0; iter->head = 0;
...@@ -2374,7 +2371,7 @@ rb_handle_head_page(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2374,7 +2371,7 @@ rb_handle_head_page(struct ring_buffer_per_cpu *cpu_buffer,
* want the outer most commit to reset it. * want the outer most commit to reset it.
*/ */
new_head = next_page; new_head = next_page;
rb_inc_page(cpu_buffer, &new_head); rb_inc_page(&new_head);
ret = rb_head_page_set_head(cpu_buffer, new_head, next_page, ret = rb_head_page_set_head(cpu_buffer, new_head, next_page,
RB_PAGE_NORMAL); RB_PAGE_NORMAL);
...@@ -2526,7 +2523,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2526,7 +2523,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
next_page = tail_page; next_page = tail_page;
rb_inc_page(cpu_buffer, &next_page); rb_inc_page(&next_page);
/* /*
* If for some reason, we had an interrupt storm that made * If for some reason, we had an interrupt storm that made
...@@ -2552,7 +2549,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2552,7 +2549,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
* the buffer, unless the commit page is still on the * the buffer, unless the commit page is still on the
* reader page. * reader page.
*/ */
if (rb_is_head_page(cpu_buffer, next_page, &tail_page->list)) { if (rb_is_head_page(next_page, &tail_page->list)) {
/* /*
* If the commit is not on the reader page, then * If the commit is not on the reader page, then
...@@ -2879,7 +2876,7 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -2879,7 +2876,7 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer)
return; return;
local_set(&cpu_buffer->commit_page->page->commit, local_set(&cpu_buffer->commit_page->page->commit,
rb_page_write(cpu_buffer->commit_page)); rb_page_write(cpu_buffer->commit_page));
rb_inc_page(cpu_buffer, &cpu_buffer->commit_page); rb_inc_page(&cpu_buffer->commit_page);
/* add barrier to keep gcc from optimizing too much */ /* add barrier to keep gcc from optimizing too much */
barrier(); barrier();
} }
...@@ -3638,14 +3635,14 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -3638,14 +3635,14 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer,
* Because the commit page may be on the reader page we * Because the commit page may be on the reader page we
* start with the next page and check the end loop there. * start with the next page and check the end loop there.
*/ */
rb_inc_page(cpu_buffer, &bpage); rb_inc_page(&bpage);
start = bpage; start = bpage;
do { do {
if (bpage->page == (void *)addr) { if (bpage->page == (void *)addr) {
local_dec(&bpage->entries); local_dec(&bpage->entries);
return; return;
} }
rb_inc_page(cpu_buffer, &bpage); rb_inc_page(&bpage);
} while (bpage != start); } while (bpage != start);
/* commit not part of this buffer?? */ /* commit not part of this buffer?? */
...@@ -4367,7 +4364,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -4367,7 +4364,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer->pages = reader->list.prev; cpu_buffer->pages = reader->list.prev;
/* The reader page will be pointing to the new head */ /* The reader page will be pointing to the new head */
rb_set_list_to_head(cpu_buffer, &cpu_buffer->reader_page->list); rb_set_list_to_head(&cpu_buffer->reader_page->list);
/* /*
* We want to make sure we read the overruns after we set up our * We want to make sure we read the overruns after we set up our
...@@ -4406,7 +4403,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -4406,7 +4403,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
* Now make the new head point back to the reader page. * Now make the new head point back to the reader page.
*/ */
rb_list_head(reader->list.next)->prev = &cpu_buffer->reader_page->list; rb_list_head(reader->list.next)->prev = &cpu_buffer->reader_page->list;
rb_inc_page(cpu_buffer, &cpu_buffer->head_page); rb_inc_page(&cpu_buffer->head_page);
local_inc(&cpu_buffer->pages_read); local_inc(&cpu_buffer->pages_read);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment