Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Aug 1, 2019

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 029b42ace698eae477c5e261d2f82b191507526b:

Document io_uring feature (2019-07-26 09:53:43 -0600)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 66b182f90c3f08dcbd0592ce70cb350ca5ac0cc0:

smalloc: cleanup firstfree() (2019-07-31 15:29:48 -0600)

----------------------------------------------------------------
Alexander Kapshuna (1):
fio2gnuplot: fix TabErrors when running with Python 3

Damien Le Moal (1):
bssplit: Fix handling of 0 percentage

Jens Axboe (5):
Merge branch 'gnuplot-tabs' of https://github.com/kapsh/fio
Merge branch 'dev' of https://github.com/smartxworks/fio
Merge branch 'smalloc-gc' of https://github.com/vincentkfu/fio
Remove unused fio_assert()
smalloc: cleanup firstfree()

Kyle Zhang (1):
libiscsi: continue working when meets EINTR or EAGAIN

Vincent Fu (4):
smalloc: print debug info on oom error
t/stest: make the test more challenging
smalloc: fix garbage collection problem
smalloc: fix compiler warning on Windows

 engines/libiscsi.c     |   3 +
 fio.h                  |  10 ---
 io_u.c                 |   4 +-
 smalloc.c              | 108 ++++++++++++++++++++++-
 smalloc.h              |   1 +
 t/stest.c              |  21 ++++-
 tools/plot/fio2gnuplot | 234 ++++++++++++++++++++++++-------------------------
 7 files changed, 247 insertions(+), 134 deletions(-)

---

Diff of recent changes:

engines/libiscsi.c +3 -0
index bea94c5a..58667fb2 100644
@@ -351,6 +351,9 @@ static int fio_iscsi_getevents(struct thread_data *td, unsigned int min,
 
 		ret = poll(iscsi_info->pfds, iscsi_info->nr_luns, -1);
 		if (ret < 0) {
+			if (errno == EINTR || errno == EAGAIN) {
+				continue;
+			}
 			log_err("iscsi: failed to poll events: %s.\n",
 				strerror(errno));
 			break;
fio.h +0 -10
index 2103151d..2094d30b 100644
@@ -705,16 +705,6 @@ extern void lat_target_reset(struct thread_data *);
 	    	 (i) < (td)->o.nr_files && ((f) = (td)->files[i]) != NULL; \
 		 (i)++)
 
-#define fio_assert(td, cond)	do {	\
-	if (!(cond)) {			\
-		int *__foo = NULL;	\
-		fprintf(stderr, "file:%s:%d, assert %s failed\n", __FILE__, __LINE__, #cond);	\
-		td_set_runstate((td), TD_EXITED);	\
-		(td)->error = EFAULT;		\
-		*__foo = 0;			\
-	}	\
-} while (0)
-
 static inline bool fio_fill_issue_time(struct thread_data *td)
 {
 	if (td->o.read_iolog_file ||
io_u.c +2 -2
index 910b7deb..80df2854 100644
@@ -557,10 +557,10 @@ static unsigned long long get_next_buflen(struct thread_data *td, struct io_u *i
 			for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
 				struct bssplit *bsp = &td->o.bssplit[ddir][i];
 
+				if (!bsp->perc)
+					continue;
 				buflen = bsp->bs;
 				perc += bsp->perc;
-				if (!perc)
-					break;
 				if ((r / perc <= frand_max / 100ULL) &&
 				    io_u_fits(td, io_u, buflen))
 					break;
smalloc.c +104 -4

159 lines not on this page · raw message

smalloc.h +1 -0
index 8df10e6f..1f7716f4 100644
@@ -9,6 +9,7 @@ extern void sfree(void *);
 extern char *smalloc_strdup(const char *);
 extern void sinit(void);
 extern void scleanup(void);
+extern void smalloc_debug(size_t);
 
 extern unsigned int smalloc_pool_size;
 
t/stest.c +20 -1
index b95968f1..515ae5a5 100644
@@ -11,11 +11,14 @@
 #define MAGIC2	0xf0a1e9b3
 
 #define LOOPS	32
+#define MAXSMALLOC	120*1024*1024UL
+#define LARGESMALLOC	128*1024U
 
 struct elem {
 	unsigned int magic1;
 	struct flist_head list;
 	unsigned int magic2;
+	unsigned int size;
 };
 
 static FLIST_HEAD(list);
@@ -25,13 +28,15 @@ static int do_rand_allocs(void)
 	unsigned int size, nr, rounds = 0;
 	unsigned long total;
 	struct elem *e;
+	bool error;
 
 	while (rounds++ < LOOPS) {
 #ifdef STEST_SEED
 		srand(MAGIC1);
 #endif
+		error = false;
 		nr = total = 0;
-		while (total < 120*1024*1024UL) {
+		while (total < MAXSMALLOC) {
 			size = 8 * sizeof(struct elem) + (int) (999.0 * (rand() / (RAND_MAX + 1.0)));
 			e = smalloc(size);
 			if (!e) {
@@ -40,6 +45,7 @@ static int do_rand_allocs(void)
 			}
 			e->magic1 = MAGIC1;
 			e->magic2 = MAGIC2;
+			e->size = size;
 			total += size;
 			flist_add_tail(&e->list, &list);
 			nr++;
@@ -51,8 +57,20 @@ static int do_rand_allocs(void)
 			e = flist_entry(list.next, struct elem, list);
 			assert(e->magic1 == MAGIC1);
 			assert(e->magic2 == MAGIC2);
+			total -= e->size;
 			flist_del(&e->list);
 			sfree(e);
+
+			if (!error) {
+				e = smalloc(LARGESMALLOC);
+				if (!e) {
+					error = true;
+					printf("failure allocating %u bytes at %lu allocated during sfree phase\n",
+						LARGESMALLOC, total);
+				}
+				else
+					sfree(e);
+			}
 		}
 	}
 
@@ -66,6 +84,7 @@ int main(int argc, char *argv[])
 	debug_init();
 
 	do_rand_allocs();
+	smalloc_debug(0);	/* free and total blocks should match */
 
 	scleanup();
 	return 0;
tools/plot/fio2gnuplot +117 -117

299 lines not on this page · raw message