/* FS-Cache latency histogram * * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public Licence * as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ #define FSCACHE_DEBUG_LEVEL THREAD #include #include #include #include "internal.h" atomic_t fscache_obj_instantiate_histogram[HZ]; atomic_t fscache_objs_histogram[HZ]; atomic_t fscache_ops_histogram[HZ]; atomic_t fscache_retrieval_delay_histogram[HZ]; atomic_t fscache_retrieval_histogram[HZ]; /* * display the time-taken histogram */ static int fscache_histogram_show(struct seq_file *m, void *v) { unsigned long index; unsigned n[5], t; switch ((unsigned long) v) { case 1: seq_puts(m, "JIFS SECS OBJ INST OP RUNS OBJ RUNS RETRV DLY RETRIEVLS\n"); return 0; case 2: seq_puts(m, "===== ===== ========= ========= ========= ========= =========\n"); return 0; default: index = (unsigned long) v - 3; n[0] = atomic_read(&fscache_obj_instantiate_histogram[index]); n[1] = atomic_read(&fscache_ops_histogram[index]); n[2] = atomic_read(&fscache_objs_histogram[index]); n[3] = atomic_read(&fscache_retrieval_delay_histogram[index]); n[4] = atomic_read(&fscache_retrieval_histogram[index]); if (!(n[0] | n[1] | n[2] | n[3] | n[4])) return 0; t = (index * 1000) / HZ; seq_printf(m, "%4lu 0.%03u %9u %9u %9u %9u %9u\n", index, t, n[0], n[1], n[2], n[3], n[4]); return 0; } } /* * set up the iterator to start reading from the first line */ static void *fscache_histogram_start(struct seq_file *m, loff_t *_pos) { if ((unsigned long long)*_pos >= HZ + 2) return NULL; if (*_pos == 0) *_pos = 1; return (void *)(unsigned long) *_pos; } /* * move to the next line */ static void *fscache_histogram_next(struct seq_file *m, void *v, loff_t *pos) { (*pos)++; return (unsigned long long)*pos > HZ + 2 ? NULL : (void *)(unsigned long) *pos; } /* * clean up after reading */ static void fscache_histogram_stop(struct seq_file *m, void *v) { } static const struct seq_operations fscache_histogram_ops = { .start = fscache_histogram_start, .stop = fscache_histogram_stop, .next = fscache_histogram_next, .show = fscache_histogram_show, }; /* * open "/proc/fs/fscache/histogram" to provide latency data */ static int fscache_histogram_open(struct inode *inode, struct file *file) { return seq_open(file, &fscache_histogram_ops); } const struct file_operations fscache_histogram_fops = { .open = fscache_histogram_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, }; value='1'>1space:mode:
authorEric Dumazet <edumazet@google.com>2017-02-04 07:49:21 -0800
committerDavid S. Miller <davem@davemloft.net>2017-02-04 19:38:28 -0500
commit4d6308aac3258ecad8444811a16951a919adc131 (patch)
tree866aefc115e959b34de38e715069ce0304c051af
parenta076d1bdc678a2b9157660af8bd691322c0ba3dd (diff)
virtio_net: exploit napi_complete_done() return value
Since commit 364b6055738b ("net: busy-poll: return busypolling status to drivers"), napi_complete_done() returns a boolean that can be used by drivers to conditionally rearm interrupts. This patch changes virtio_net to use this boolean to avoid a bit of overhead for busy-poll users. Jason reports about 1.1% improvement for 1 byte TCP_RR (burst 100). Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Jason Wang <jasowang@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/virtio_net.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c