-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- old/libevent-release-2.1.12-stable/event.c 2022-06-09 01:52:06.746406656 +0000 | ||
+++ new/libevent-release-2.1.12-stable/event.c 2022-06-09 01:51:04.594620903 +0000 | ||
@@ -1639,7 +1639,7 @@ | ||
int count = 0; | ||
|
||
EVUTIL_ASSERT(activeq != NULL); | ||
- | ||
+batch_start(); | ||
for (evcb = TAILQ_FIRST(activeq); evcb; evcb = TAILQ_FIRST(activeq)) { | ||
struct event *ev=NULL; | ||
if (evcb->evcb_flags & EVLIST_INIT) { | ||
@@ -1747,6 +1747,7 @@ | ||
if (base->event_continue) | ||
break; | ||
} | ||
+batch_flush(); | ||
return count; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- old/memcached-1.6.15/thread.c 2022-06-09 01:59:43.605398261 +0000 | ||
+++ new/memcached-1.6.15/thread.c 2022-06-09 02:01:16.581275340 +0000 | ||
@@ -497,6 +497,8 @@ | ||
/* | ||
* Worker thread: main event loop | ||
*/ | ||
+extern void init_worker(int); | ||
+int worker_index = 0; | ||
static void *worker_libevent(void *arg) { | ||
LIBEVENT_THREAD *me = arg; | ||
|
||
@@ -514,7 +516,7 @@ | ||
} | ||
|
||
register_thread_initialized(); | ||
- | ||
+ init_worker(worker_index++); | ||
event_base_loop(me->base, 0); | ||
|
||
// same mechanism used to watch for all threads exiting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
lib_saio_dir=$(find $(pwd) -type d -name "wrapper" | sed 's_/_\\/_g') | ||
libpath=$1 | ||
|
||
# modify libevent | ||
sed -i "s/LDFLAGS =.*/& -Wl,-rpath -Wl,${lib_saio_dir}/" ${libpath}/Makefile | ||
sed -i "s/LIBS =.*/& -L${lib_saio_dir} -ldummy/" ${libpath}/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
lib_saio_dir=$(find $(pwd) -type d -name "wrapper" | sed 's_/_\\/_g') | ||
libevent_dir=$(find $(pwd) -type d -path "*/local/lib" | sed 's_/_\\/_g') | ||
mempath=$1 | ||
|
||
# modify memcached | ||
sed -i "s/LDFLAGS =.*/& -Wl,-rpath -Wl,${lib_saio_dir}/" ${mempath}/Makefile | ||
sed -i "s/LDFLAGS =.*/& -Wl,-rpath -Wl,${libevent_dir}/" ${mempath}/Makefile | ||
sed -i "s/LIBS =.*/& -L${lib_saio_dir} -ldummy/" ${mempath}/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
ssize_t sendmsg(int sockfd, const struct msghdr* msg, int flags) | ||
{ | ||
if (!in_segment) { | ||
return real_sendmsg(sockfd, msg, flags); | ||
} | ||
|
||
int idx = this_worker_id * RATIO + (sockfd % RATIO); | ||
batch_num++; | ||
|
||
int i = table[idx]->tail_table; | ||
int j = table[idx]->tail_entry; | ||
|
||
/* check out of bound */ | ||
msg_offset = msg_offset & MSG_MASK; | ||
iov_offset = iov_offset & IOV_MASK; | ||
|
||
int res = 0; | ||
struct iovec* iov = msg->msg_iov; | ||
int iovlen = msg->msg_iovlen, start_iov_offset = iov_offset; | ||
|
||
for (int k = 0; k < iovlen; k++) { | ||
int ll = iov[k].iov_len; // number of bytes | ||
|
||
/* handle string */ | ||
if (pool_offset + (ull)(ll) > MAX_POOL_SIZE) | ||
pool_offset = 0; | ||
|
||
memcpy((void*)((unsigned char*)mpool + pool_offset), iov[k].iov_base, ll); | ||
|
||
iov_offset = iov_offset & IOV_MASK; | ||
iovpool[iov_offset].iov_base = (void*)((unsigned char*)mpool + pool_offset); | ||
iovpool[iov_offset].iov_len = ll; | ||
|
||
/* update index of iovec array */ | ||
iov_offset++; | ||
|
||
/* update offset of character pool */ | ||
pool_offset += (size_t)(ll); | ||
|
||
res += ll; | ||
} | ||
|
||
/* copy msghdr */ | ||
msgpool[msg_offset].msg_name = NULL; // FIXME: should be more general | ||
msgpool[msg_offset].msg_namelen = 0; | ||
msgpool[msg_offset].msg_iov = (struct iovec*)(&iovpool[start_iov_offset]); | ||
msgpool[msg_offset].msg_iovlen = iovlen; | ||
msgpool[msg_offset].msg_control = NULL; | ||
msgpool[msg_offset].msg_controllen = 0; | ||
msgpool[msg_offset].msg_flags = msg->msg_flags; | ||
|
||
table[idx]->user_tables[i][j].sysnum = __ESCA_sendmsg; | ||
table[idx]->user_tables[i][j].nargs = 3; | ||
table[idx]->user_tables[i][j].args[0] = sockfd; | ||
table[idx]->user_tables[i][j].args[1] = (long)(&msgpool[msg_offset]); | ||
table[idx]->user_tables[i][j].args[2] = flags; | ||
|
||
msg_offset++; | ||
update_index(idx); | ||
|
||
esca_smp_store_release(&table[idx]->user_tables[i][j].rstatus, BENTRY_BUSY); | ||
|
||
/* assume success */ | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters