Project

General

Profile

Actions

Bug #13249

closed

wasteful entry allocation in dnlc

Added by Mateusz Guzik over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

The namecache entry has the following layout:

> ::print -a ncache_t
0 {
    0 hash_next 
    8 hash_prev 
    10 vp 
    18 dp 
    20 hash 
    24 namlen 
    25 name 
}

which implies:

> ::sizeof ncache_t
sizeof (ncache_t) = 0x28

but then dnlc_get:

        ncp = kmem_alloc(sizeof (ncache_t) + namlen, KM_NOSLEEP);

Requests 3 bytes more than expected. Instead the code should be using offsetof(ncache_t, name) here and in dnlc_free (and perhaps size computation could be deduped).

Actions

Also available in: Atom PDF