mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
CLEANUP: fd: remove leftovers of the fdcache
The "cache" entry was still present in the fdtab struct and it was reported in "show sess". Removing it broke the cache-line alignment on 64-bit machines which is important for threads, so it was fixed by adding an attribute(aligned()) when threads are in use. Doing it only in this case allows 32-bit thread-less platforms to see the struct fit into 32 bytes.
This commit is contained in:
parent
30362908d8
commit
76913d3ef4
@ -120,7 +120,6 @@ struct fdtab {
|
|||||||
__decl_hathreads(HA_SPINLOCK_T lock);
|
__decl_hathreads(HA_SPINLOCK_T lock);
|
||||||
unsigned long thread_mask; /* mask of thread IDs authorized to process the task */
|
unsigned long thread_mask; /* mask of thread IDs authorized to process the task */
|
||||||
unsigned long update_mask; /* mask of thread IDs having an update for fd */
|
unsigned long update_mask; /* mask of thread IDs having an update for fd */
|
||||||
struct fdlist_entry cache; /* Entry in the fdcache */
|
|
||||||
struct fdlist_entry update; /* Entry in the global update list */
|
struct fdlist_entry update; /* Entry in the global update list */
|
||||||
void (*iocb)(int fd); /* I/O handler */
|
void (*iocb)(int fd); /* I/O handler */
|
||||||
void *owner; /* the connection or listener associated with this fd, NULL if closed */
|
void *owner; /* the connection or listener associated with this fd, NULL if closed */
|
||||||
@ -128,7 +127,14 @@ struct fdtab {
|
|||||||
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
|
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
|
||||||
unsigned char linger_risk:1; /* 1 if we must kill lingering before closing */
|
unsigned char linger_risk:1; /* 1 if we must kill lingering before closing */
|
||||||
unsigned char cloned:1; /* 1 if a cloned socket, requires EPOLL_CTL_DEL on close */
|
unsigned char cloned:1; /* 1 if a cloned socket, requires EPOLL_CTL_DEL on close */
|
||||||
};
|
}
|
||||||
|
#ifdef USE_THREAD
|
||||||
|
/* only align on cache lines when using threads; 32-bit small archs
|
||||||
|
* can put everything in 32-bytes when threads are disabled.
|
||||||
|
*/
|
||||||
|
__attribute__((aligned(64)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
/* less often used information */
|
/* less often used information */
|
||||||
struct fdinfo {
|
struct fdinfo {
|
||||||
|
1
src/fd.c
1
src/fd.c
@ -596,7 +596,6 @@ int init_pollers()
|
|||||||
for (p = 0; p < global.maxsock; p++) {
|
for (p = 0; p < global.maxsock; p++) {
|
||||||
HA_SPIN_INIT(&fdtab[p].lock);
|
HA_SPIN_INIT(&fdtab[p].lock);
|
||||||
/* Mark the fd as out of the fd cache */
|
/* Mark the fd as out of the fd cache */
|
||||||
fdtab[p].cache.next = -3;
|
|
||||||
fdtab[p].update.next = -3;
|
fdtab[p].update.next = -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3214,11 +3214,10 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
|
|||||||
obj_base_ptr(conn->target));
|
obj_base_ptr(conn->target));
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" flags=0x%08x fd=%d fd.state=%02x fd.cache=%d updt=%d fd.tmask=0x%lx\n",
|
" flags=0x%08x fd=%d fd.state=%02x updt=%d fd.tmask=0x%lx\n",
|
||||||
conn->flags,
|
conn->flags,
|
||||||
conn->handle.fd,
|
conn->handle.fd,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
|
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].cache.next >= -2 : 0,
|
|
||||||
conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
|
conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||||
|
|
||||||
@ -3251,11 +3250,10 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
|
|||||||
obj_base_ptr(conn->target));
|
obj_base_ptr(conn->target));
|
||||||
|
|
||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" flags=0x%08x fd=%d fd.state=%02x fd.cache=%d updt=%d fd.tmask=0x%lx\n",
|
" flags=0x%08x fd=%d fd.state=%02x updt=%d fd.tmask=0x%lx\n",
|
||||||
conn->flags,
|
conn->flags,
|
||||||
conn->handle.fd,
|
conn->handle.fd,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
|
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].cache.next >= -2 : 0,
|
|
||||||
conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
|
conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
|
||||||
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user