I/O buffers are allocated on aligned boundaries. The I/O buffer descriptor (the struct io_buffer) is currently attached to the end of the I/O buffer. When the size of the buffer is close to its alignment, this can waste large amounts of aligned memory. For example, a network card using 2048-byte receive buffers will end up allocating 2072 bytes on a 2048-byte boundary. This effectively wastes 50% of the available memory. Improve the situation by allocating the descriptor separately from the main I/O buffer if inline allocation would cause the total allocated size to cross the alignment boundary. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
40 |
|
40 |
|
41 |
|
41 |
|
42 |
|
42 |
|
43 |
|
|
|
|
43 |
|
|
44 |
|
44 |
|
45 |
|
45 |
|
46 |
|
46 |
|
|
|
||
57 |
|
57 |
|
58 |
|
58 |
|
59 |
|
59 |
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
64 |
|
78 |
|
65 |
|
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
66 |
|
88 |
|
67 |
|
|
|
|
89 |
|
|
|
90 |
|
|
68 |
|
91 |
|
69 |
|
92 |
|
70 |
|
93 |
|
|
|
||
75 |
|
98 |
|
76 |
|
99 |
|
77 |
|
100 |
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
84 |
|
124 |
|
85 |
|
125 |
|
86 |
|
126 |
|