Merge lp:~mapreri/libeatmydata/1556410 into lp:libeatmydata

Proposed by Mattia Rizzolo
Status: Rejected
Rejected by: Stewart Smith
Proposed branch: lp:~mapreri/libeatmydata/1556410
Merge into: lp:libeatmydata
Diff against target: 64 lines (+10/-5)
2 files modified
Makefile.am (+1/-1)
libeatmydata/libeatmydata.c (+9/-4)
To merge this branch: bzr merge lp:~mapreri/libeatmydata/1556410
Reviewer Review Type Date Requested Status
Stewart Smith Pending
Review via email: mp+288856@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mattia Rizzolo (mapreri) wrote :

I forgot, the author of the patch is Samuel Thibault <email address hidden>... maybe you want to credit him somewhere (I should have added it to the commit message, maybe)

Revision history for this message
Mattia Rizzolo (mapreri) wrote :
Revision history for this message
Mattia Rizzolo (mapreri) wrote :

(Please reject this, it seems as if I don't have the ability to mark the MR as "reject".)

Revision history for this message
Stewart Smith (stewart) wrote :

Cheers - I'll have a look on github. It turns out it's been a while since I looked at Launchpad.

Unmerged revisions

106. By Mattia Rizzolo

Use a weak reference to pthread_testcancel, so that it's called only if the program itself pulls libpthread

This avoid an hard link on pthread.

libeatmydata is linked against libpthread. This thus pulls libpthread
in all processes run under eatmydata. It happens that having
libpthread in a process makes pthread_mutex_lock() and all such basic
performance-sensitive operations much heavier (since they then have to
deal with potential multithreading). This avoids that by using a weak reference
to pthread_testcancel, so that pthread_testcancel is called only if the program
itself pulls libpthread.

LP: #1556410

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2014-10-29 22:54:17 +0000
3+++ Makefile.am 2016-03-12 11:42:21 +0000
4@@ -80,7 +80,7 @@
5 $(NO_WERROR) \
6 -DBUILDING_LIBEATMYDATA
7
8-libeatmydata_la_LIBADD = $(LIBDL_LIBS) -lpthread
9+libeatmydata_la_LIBADD = $(LIBDL_LIBS)
10 libeatmydata_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
11
12 #install-exec-hook:
13
14=== modified file 'libeatmydata/libeatmydata.c'
15--- libeatmydata/libeatmydata.c 2014-10-29 22:32:44 +0000
16+++ libeatmydata/libeatmydata.c 2016-03-12 11:42:21 +0000
17@@ -67,6 +67,7 @@
18 libc_##name = (libc_##name##_##t)(intptr_t)dlsym(RTLD_NEXT, #name); \
19 dlerror();
20
21+#pragma weak pthread_testcancel
22
23 int LIBEATMYDATA_API msync(void *addr, size_t length, int flags);
24 static int initing = 0;
25@@ -113,7 +114,8 @@
26 int LIBEATMYDATA_API fsync(int fd)
27 {
28 if (eatmydata_is_hungry()) {
29- pthread_testcancel();
30+ if (pthread_testcancel)
31+ pthread_testcancel();
32 errno= 0;
33 return 0;
34 }
35@@ -188,7 +190,8 @@
36 int LIBEATMYDATA_API fdatasync(int fd)
37 {
38 if (eatmydata_is_hungry()) {
39- pthread_testcancel();
40+ if (pthread_testcancel)
41+ pthread_testcancel();
42 errno= 0;
43 return 0;
44 }
45@@ -199,7 +202,8 @@
46 int LIBEATMYDATA_API msync(void *addr, size_t length, int flags)
47 {
48 if (eatmydata_is_hungry()) {
49- pthread_testcancel();
50+ if (pthread_testcancel)
51+ pthread_testcancel();
52 errno= 0;
53 return 0;
54 }
55@@ -211,7 +215,8 @@
56 int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
57 {
58 if (eatmydata_is_hungry()) {
59- pthread_testcancel();
60+ if (pthread_testcancel)
61+ pthread_testcancel();
62 errno= 0;
63 return 0;
64 }

Subscribers

People subscribed via source and target branches

to all changes: