-
Notifications
You must be signed in to change notification settings - Fork 48
add NOSHARE flag #336
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
base: master
Are you sure you want to change the base?
add NOSHARE flag #336
Conversation
3fff47b to
46a783a
Compare
lunatik_obj.c
Outdated
| if (!object->shared) | ||
| luaL_error(L, "%s objects cannot be shared across runtimes", object->class->name); |
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.
it's not enough, right? we probably need to add single flag to the API for creating new 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.
also, avoiding creating mutex/spinlock and refcount unnecessarily..
| union { | ||
| struct mutex mutex; | ||
| spinlock_t spin; | ||
| }; |
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.
maybe we should have a substruct allocated dynamically for kref and lock.. but let's worry about this after having the first version settled..
| #define lunatik_class_issleepable(cls) ((cls)->sleep) | ||
|
|
||
| #define lunatik_locker(o, mutex_op, spin_op) \ | ||
| do { \ |
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.
it should check if it's single, right? it should lock in that case.. also, refcount shouldn't be applied if single
|
This version lunatik driver is working properly... |
lunatik.h
Outdated
| static inline int lunatik_trylock(lunatik_object_t *object) | ||
| { | ||
| return object->sleep ? mutex_trylock(&object->mutex) : spin_trylock_bh(&object->spin); | ||
| return object->single ? 1 : lunatik_object_issleepable(object) ? mutex_trylock(&object->mutex) : spin_trylock_bh(&object->spin); |
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 should we return 1 if single? what's the use case?
| object->gfp = sleep ? GFP_KERNEL : GFP_ATOMIC; | ||
| lunatik_newlock(object); | ||
| if(!single) | ||
| lunatik_newlock(object); |
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.
we don't need refcount as well, right?
| lunatik_object_t *object = lunatik_newobject(L, &luadata_class, sizeof(luadata_t)); | ||
| luadata_t *data = (luadata_t *)object->private; | ||
|
|
||
| object->single = single; |
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.
doing this after the object creation won't avoid the lock init
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.
Wanted to know if im going in correct direction for creating objects:here
I didnt update the function here yet... Will do update this.. (the line is just redundancy as of now, will remove)
|
Hi |
Agreed; also, this will be useful for other objects as well, I think |
|
hi @Physic69, I'm thinking that it would be better for me to tackle this issue if it's cool for you. I think I will need diff exec modes for bottom halves and irqs, I could bundle single mode on this change or at least create the flag (for implementing the decision later). Is it alright for you? Then, you could tackle another issue ;-). Thanks. |
Sure, that’s totally fine 👍... |
No description provided.