hrev48151 adds 2 changesets to branch 'master' old head: f9f19f02463199d35c7d981d88fb3daf416cf7ba new head: dfb13a87166f6802fa7949f13e73e292034b6672 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=dfb13a8+%5Ef9f19f0 ---------------------------------------------------------------------------- 6bbd25f: Make vfs_resize_fd_table() accessible in the kernel Also update some types from int to uint32. dfb13a8: Increase the size of the kernel FD table With packagefs potentially opening quite a few packages the default of 256 slots is a bit tight. It's 4096 now, which should be safe for a while, but we might want to consider resizing the table dynamically and probably even switching to another algorithm for allocating the slots. Should fix #11328. [ Ingo Weinhold <ingo_weinhold@xxxxxx> ] ---------------------------------------------------------------------------- 3 files changed, 10 insertions(+), 6 deletions(-) headers/private/kernel/vfs.h | 1 + src/system/kernel/fs/vfs.cpp | 12 ++++++------ src/system/kernel/team.cpp | 3 +++ ############################################################################ Commit: 6bbd25f071e5981c15444c8ba28a92b145b77566 URL: http://cgit.haiku-os.org/haiku/commit/?id=6bbd25f Author: Ingo Weinhold <ingo_weinhold@xxxxxx> Date: Wed Oct 29 20:01:29 2014 UTC Make vfs_resize_fd_table() accessible in the kernel Also update some types from int to uint32. ---------------------------------------------------------------------------- diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index a5c9dfc..c9e6a28 100644 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -73,6 +73,7 @@ io_context* vfs_new_io_context(io_context* parentContext, bool purgeCloseOnExec); void vfs_get_io_context(io_context *context); void vfs_put_io_context(io_context *context); +status_t vfs_resize_fd_table(struct io_context* context, uint32 newSize); int vfs_getrlimit(int resource, struct rlimit *rlp); int vfs_setrlimit(int resource, const struct rlimit *rlp); diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index fa67829..3c44885 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -4941,23 +4941,23 @@ vfs_put_io_context(io_context* context) } -static status_t -vfs_resize_fd_table(struct io_context* context, const int newSize) +status_t +vfs_resize_fd_table(struct io_context* context, uint32 newSize) { - if (newSize <= 0 || newSize > MAX_FD_TABLE_SIZE) + if (newSize == 0 || newSize > MAX_FD_TABLE_SIZE) return B_BAD_VALUE; TIOC(ResizeIOContext(context, newSize)); MutexLocker _(context->io_mutex); - int oldSize = context->table_size; + uint32 oldSize = context->table_size; int oldCloseOnExitBitmapSize = (oldSize + 7) / 8; int newCloseOnExitBitmapSize = (newSize + 7) / 8; // If the tables shrink, make sure none of the fds being dropped are in use. if (newSize < oldSize) { - for (int i = oldSize; i-- > newSize;) { + for (uint32 i = oldSize; i-- > newSize;) { if (context->fds[i]) return B_BUSY; } @@ -4982,7 +4982,7 @@ vfs_resize_fd_table(struct io_context* context, const int newSize) context->table_size = newSize; // copy entries from old tables - int toCopy = min_c(oldSize, newSize); + uint32 toCopy = min_c(oldSize, newSize); memcpy(context->fds, oldFDs, sizeof(void*) * toCopy); memcpy(context->select_infos, oldSelectInfos, sizeof(void*) * toCopy); ############################################################################ Revision: hrev48151 Commit: dfb13a87166f6802fa7949f13e73e292034b6672 URL: http://cgit.haiku-os.org/haiku/commit/?id=dfb13a8 Author: Ingo Weinhold <ingo_weinhold@xxxxxx> Date: Wed Oct 29 20:06:27 2014 UTC Ticket: https://dev.haiku-os.org/ticket/11328 Increase the size of the kernel FD table With packagefs potentially opening quite a few packages the default of 256 slots is a bit tight. It's 4096 now, which should be safe for a while, but we might want to consider resizing the table dynamically and probably even switching to another algorithm for allocating the slots. Should fix #11328. ---------------------------------------------------------------------------- diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index e8c58de..3fb33aa 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -2793,6 +2793,9 @@ team_init(kernel_args* args) if (sKernelTeam->io_context == NULL) panic("could not create io_context for kernel team!\n"); + if (vfs_resize_fd_table(sKernelTeam->io_context, 4096) != B_OK) + dprintf("Failed to resize FD table for kernel team!\n"); + // stick it in the team hash sTeamHash.Insert(sKernelTeam);