This looks good now. Only question is whether you need to worry about cache-aligning the table, but that's a tuning option that can be considered later if needed.
On Tue, Sep 13, 2016 at 7:40 AM, Christophe Milard < [email protected]> wrote: > The table containing the saved file-descriptors<->{context, key} couples is > now dynamically malloc'd in the fd server process, hence avoiding > the memory waste which happened in other process when the table was > staticaly reserved in all processes. > > Signed-off-by: Christophe Milard <[email protected]> > Reviewed-by: Bill Fischofer <[email protected]> > --- > platform/linux-generic/_fdserver.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_ > fdserver.c > index bf36eb2..5cef806 100644 > --- a/platform/linux-generic/_fdserver.c > +++ b/platform/linux-generic/_fdserver.c > @@ -73,7 +73,7 @@ typedef struct fdentry_s { > uint64_t key; > int fd; > } fdentry_t; > -static fdentry_t fd_table[FDSERVER_MAX_ENTRIES]; > +static fdentry_t *fd_table; > static int fd_table_nb_entries; > > /* > @@ -622,8 +622,20 @@ int _odp_fdserver_init_global(void) > /* TODO: pin the server on appropriate service cpu mask */ > /* when (if) we can agree on the usage of service mask */ > > + /* allocate the space for the file descriptor<->key table: > */ > + fd_table = malloc(FDSERVER_MAX_ENTRIES * > sizeof(fdentry_t)); > + if (!fd_table) { > + ODP_ERR("maloc failed!\n"); > + exit(1); > + } > + > + /* wait for clients requests */ > wait_requests(sock); /* Returns when server is stopped */ > close(sock); > + > + /* release the file descriptor table: */ > + free(fd_table); > + > exit(0); > } > > -- > 2.7.4 > >
