-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fs/vfs: initialize uio only if lower implement readv/writev #15603
base: master
Are you sure you want to change the base?
Conversation
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides some information, it lacks crucial details. Here's a breakdown:
In short, the PR needs to be more thorough and provide concrete evidence of the change's impact and effectiveness. More detailed explanations and actual testing logs are essential for proper review and acceptance. |
c1758db
to
7e7b069
Compare
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.
is this same as a part of #15604?
if yes, i'm against this for the same reason i stated in #15604 (review).
Point 1 to answer your question |
@yamt we could review this PR first, just some uio logic adjustment |
|
In the uio case, you need to accumulate the length, but non-iovec not.
any example? |
a single size_t value alone can exceed SSIZE_MAX.
yamt@67c9bc6 |
The codes in the red line can be skip all |
"if you just want to save a function call for uio_init" |
OK, my opinion has not changed, “uio could be skipped when reading and writing a single vector buffer“, could we reach a consensus on this option? |
i agree it's possible. btw, do you have any plans on how preadv/pread would look like with your approach? |
we can refer to Linux, but the difference from Linux is that in the single vector buffer scenario, we do not use iov_iter(uio):
https://github.com/torvalds/linux/blob/master/fs/read_write.c#L1167-L1173 |
I think I may have convinced you a little? Let's go back to this PR, so it is reasonable to provide both uio and non-uio cases in RTOS, right? could you review this PR further? |
not really. i guess the main disagreement between us is on how large the overhead is. well, even if the benchmark proves me wrong, i'm against today's version of the PR because it drops the EINVAL check and anchao didn't explain why it was desirable. also, i feel this PR contains too many unrelated changes. (whitespaces, removing assertions for non obvious reasons, etc) |
I need a balance. You think writev/readv is important and it needs uio. I have no objection. Why must uio be used for read/write? Your modification has inexplicably added a lot of cycle load to everyone's program. Have n't you understand your problem?
I will bring back EINVAL check, OK?
Where is the extra space? Where is non obvious issue? Comment to PR? OK? |
read test on sim/nsh ubuntu 24.04: with your patch:
with out your patch( -18% ):
test code:
|
i agree on that.
because unified logic is easier to maintain.
i will do so later. |
thank you for the benchmark. |
Yes
I just revert writev/readv refactor code:
|
fs/vfs/fs_uio.c
Outdated
@@ -126,12 +126,14 @@ int uio_init(FAR struct uio *uio, FAR const struct iovec *iov, int iovcnt) | |||
ssize_t resid; | |||
|
|||
memset(uio, 0, sizeof(*uio)); | |||
|
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.
unrelated whitespace changes
to me, all changes to this file looks cosmetic and unrelated to the rest of this commit.
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.
just make the code easier to read, let me revert
int i; | ||
|
||
DEBUGASSERT(inode->u.i_ops->read != NULL); |
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.
how is this assertion removal related to the rest of this commit? ditto for writev
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.
fs/vfs/fs_read.c
Outdated
{ | ||
FAR struct inode *inode; | ||
ssize_t ret = -EBADF; | ||
struct uio uio; |
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.
i think it's better to move this to where it's used. ie. the if (inode->u.i_ops->readv)
block. what do you think?
ditto for writev.
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.
Done
to simple signle read/write logic, initialize uio only if lower implement readv/writev Signed-off-by: chao an <[email protected]>
Signed-off-by: chao an <[email protected]>
@yamt please review again |
Summary
fs/vfs: initialize uio only if lower implement readv/writev
to simple signle read/write logic, initialize uio only if lower implement readv/writev
Impact
N/A
Testing
nsh/sim