lxip: configure thash/uhash entries to 2048

The number of hash entries for TCP/UDP corresponds to the number of
sockets managed by the stack. In case there are more sockets than
entries available, buckets will be created to compensate for the lack of
space. The default values for TCP (524288) and UDP (65536) are meant for
the in kernel that manages all sockets of the user land and leads
to very large hash table allocations (>20MB) during initialization.

Since on Genode a component has its own instance of the IP stack or uses
the VFS server, we do not need these kind of large default settings.

issue #2181
This commit is contained in:
Sebastian Sumpf 2023-12-13 19:54:50 +01:00
parent c4679e7af6
commit 68ac1347b9
3 changed files with 20 additions and 1 deletions

View File

@ -316,7 +316,6 @@ DUMMY(-1, kobject_put)
DUMMY(-1, kobject_uevent)
DUMMY(-1, krealloc)
DUMMY(-1, kstrdup)
DUMMY(-1, kstrtoul)
DUMMY(-1, ktime_equal)
DUMMY(-1, ktime_to_timespec)
DUMMY(-1, ktime_to_timeval)

View File

@ -485,6 +485,15 @@ void late_ip_auto_config(void);
void late_tcp_congestion_default(void);
int __set_thash_entries(char *str);
int __set_uhash_entries(char *str);
static void lxip_kernel_params(void)
{
__set_thash_entries("2048");
__set_uhash_entries("2048");
}
/**
* Initialize sub-systems
*/
@ -498,6 +507,8 @@ void lxip_init()
/* sub-systems */
subsys_net_dev_init();
lxip_kernel_params();
fs_inet_init();
/* enable local accepts */

View File

@ -660,3 +660,12 @@ int schedule_delayed_work(struct delayed_work *dwork, unsigned long delay)
{
return mod_delayed_work(0, dwork, delay);
}
int kstrtoul(const char *s, unsigned int base, unsigned long *res)
{
unsigned long val = 0;
Genode::ascii_to(s, val);
*res = val;
return 0;
}