/* * benchmark.c: * Author: Konstantin Khlebnikov * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #include #include #include #include #include "test.h" #define NSEC_PER_SEC 1000000000L static long long benchmark_iter(struct radix_tree_root *root, bool tagged) { volatile unsigned long sink = 0; struct radix_tree_iter iter; struct timespec start, finish; long long nsec; int l, loops = 1; void **slot; #ifdef BENCHMARK again: #endif clock_gettime(CLOCK_MONOTONIC, &start); for (l = 0; l < loops; l++) { if (tagged) { radix_tree_for_each_tagged(slot, root, &iter, 0, 0) sink ^= (unsigned long)slot; } else { radix_tree_for_each_slot(slot, root, &iter, 0) sink ^= (unsigned long)slot; } } clock_gettime(CLOCK_MONOTONIC, &finish); nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + (finish.tv_nsec - start.tv_nsec); #ifdef BENCHMARK if (loops == 1 && nsec * 5 < NSEC_PER_SEC) { loops = NSEC_PER_SEC / nsec / 4 + 1; goto again; } #endif nsec /= loops; return nsec; } static void benchmark_size(unsigned long size, unsigned long step, int order) { RADIX_TREE(tree, GFP_KERNEL); long long normal, tagged; unsigned long index; for (index = 0 ; index < size ; index += step) { item_insert_order(&tree, index, order); radix_tree_tag_set(&tree, index, 0); } tagged = benchmark_iter(&tree, true); normal = benchmark_iter(&tree, false); printf("Size %ld, step %6ld, order %d tagged %10lld ns, normal %10lld ns\n", size, step, order, tagged, normal); item_kill_tree(&tree); rcu_barrier(); } void benchmark(void) { unsigned long size[] = {1 << 10, 1 << 20, 0}; unsigned long step[] = {1, 2, 7, 15, 63, 64, 65, 128, 256, 512, 12345, 0}; int c, s; printf("starting benchmarks\n"); printf("RADIX_TREE_MAP_SHIFT = %d\n", RADIX_TREE_MAP_SHIFT); for (c = 0; size[c]; c++) for (s = 0; step[s]; s++) benchmark_size(size[c], step[s], 0); for (c = 0; size[c]; c++) for (s = 0; step[s]; s++) benchmark_size(size[c], step[s] << 9, 9); } e=''/>
alue='f2557779e1a9cfbf69c99b74da26cc1b2b10e752'/>
AgeCommit message (Expand)AuthorFilesLines
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-02 12:34:27 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-02 12:34:27 -0800
commitf2557779e1a9cfbf69c99b74da26cc1b2b10e752 (patch)
tree8ddca65c897199add553948c429072b8bd463692 /drivers/usb/core/usb.h
parent6d04dfc8966019b8b0977b2cb942351f13d2b178 (diff)
parent030305d69fc6963c16003f50d7e8d74b02d0a143 (diff)
Merge tag 'pci-v4.10-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fix from Bjorn Helgaas: "Configure ASPM on the link from a PCI-to-PCIe bridge (avoids a NULL pointer dereference on topologies including these bridges)" * tag 'pci-v4.10-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: PCI/ASPM: Handle PCI-to-PCIe bridges as roots of PCIe hierarchies
Diffstat (limited to 'drivers/usb/core/usb.h')