-
Notifications
You must be signed in to change notification settings - Fork 2.1k
core: make clist singly-linked #4923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Nice! |
I like! |
@@ -16,7 +16,8 @@ | |||
|
|||
#define TEST_CLIST_LEN (8) | |||
|
|||
static clist_node_t tests_clist_buf[TEST_CLIST_LEN]; | |||
static list_node_t tests_clist_buf[TEST_CLIST_LEN]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below: the datatype is called list
now so the variable, function and file names should reflect that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if clist_*() works with list_node_t objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But doesn't clist
stand for circular list? (or is it that still)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I shared the list node definition between the two header files. Now I copied the definition, do you prefer it that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why copy when you can
typedef list_t clist_t;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef'ed it is now.
6a376dd
to
62504f3
Compare
|
Why does this depend on #4557? This data structure should be independent of that change, right? |
Why can't you take the list.h introduction over here and make #4557 dependent on this PR. That seems to be the more logical dependency graph to me. |
Dependency not yet merged. Postponed. |
Sad. |
Agreed, but currently I don't see realistic chances for #4557 to get merged until tomorrow. Do you disagree? |
Can't review it myself... |
You can kick your reviewers. ;) |
cf058ed
to
b308448
Compare
* | ||
* Each list is represented as a "clist_node_t". It's only member, the "next" | ||
* pointer, points to the last entry in the list, whose "next" pointer points to | ||
* the first entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something reads weird here, how about
... . It's only member, the "next" pointer, points to the next entry in the list. The last element's "next" pointer points to the first entry.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missread the sentence, never mind...
Needs rebase. |
b308448
to
0415ff9
Compare
|
Code looks good, works as expected (on 'native' and some ARM boards), code size is smaller than before -> ACK! |
code looks sensible and changes make sense. ACK |
0415ff9
to
1bac3f3
Compare
clist was doubly linked in order to enable removal of threads from a run queue in constant time.
Today I realized that only the currently running thread can remove itself from a running queue (by blocking for a msg, mutex, sleeping, ...), and a singly linked but circular list offers O(1) removal of the head element.
So I changed clist accordingly.
This carves off 4 byte of tcb and increases context switch
timeperformance by ~4%.Waiting for #4557.