{"push_id":1066442108,"size":70,"distinct_size":70,"ref":"refs/heads/test3","head":"59e37c5542fc267fac13f8758d2d4f697ed9cf25","before":"492377a32bbc9abe187afbfe0ec78a131511dc36","commits":[{"sha":"463550779e52ad1c65ccb9038766e9d702b3da66","author":{"email":"203686835f49d1750fcbb70065cda5c503139a61@android.com","name":"Arve Hjonnevag"},"message":"Staging: android: binder: More offset validation.\n\nMake sure offsets don't point to overlapping flat_binder_object\nstructs.\n\nChange-Id: I425ab0c46fbe2b00ed679c5becf9e8140395eb40\nSigned-off-by: Arve HjÃ¸nnevÃ¥g <arve@android.com>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/463550779e52ad1c65ccb9038766e9d702b3da66"},{"sha":"5ffd2af461af6ff836c09f8c29bfea067d53c493","author":{"email":"9b1c8d0d87781ef17f673ecc47a3de2dffc1767c@gmail.com","name":"bsmitty83"},"message":"omap2 fixups\n\nConflicts:\n\tarch/arm/mach-omap2/omap4_trim_quirks.c","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/5ffd2af461af6ff836c09f8c29bfea067d53c493"},{"sha":"27dfdd5f927ba31f83a9ef1f6ef4ca6d7b3ce0b9","author":{"email":"e75153c795ef6a5a250816f5790445793ba60e94@p23q.org","name":"David R. Piegdon"},"message":"ARM: OMAP2+: Fix parser-bug in platform muxing code\n\ncommit c021f241f4fab2bb4fc4120a38a828a03dd3f970 upstream.\n\nFix a parser-bug in the omap2 muxing code where muxtable-entries will be\nwrongly selected if the requested muxname is a *prefix* of their\nm0-entry and they have a matching mN-entry. Fix by additionally checking\nthat the length of the m0_entry is equal.\n\nFor example muxing of \"dss_data2.dss_data2\" on omap32xx will fail\nbecause the prefix \"dss_data2\" will match the mux-entries \"dss_data2\" as\nwell as \"dss_data20\", with the suffix \"dss_data2\" matching m0 (for\ndss_data2) and m4 (for dss_data20). Thus both are recognized as signal\npath candidates:\n\nRelevant muxentries from mux34xx.c:\n        _OMAP3_MUXENTRY(DSS_DATA20, 90,\n                \"dss_data20\", NULL, \"mcspi3_somi\", \"dss_data2\",\n                \"gpio_90\", NULL, NULL, \"safe_mode\"),\n        _OMAP3_MUXENTRY(DSS_DATA2, 72,\n                \"dss_data2\", NULL, NULL, NULL,\n                \"gpio_72\", NULL, NULL, \"safe_mode\"),\n\nThis will result in a failure to mux the pin at all:\n\n _omap_mux_get_by_name: Multiple signal paths (2) for dss_data2.dss_data2\n\nPatch should apply to linus' latest master down to rather old linux-2.6\ntrees.\n\nSigned-off-by: David R. Piegdon <lkml@p23q.org>\nCc: stable@vger.kernel.org\n[tony@atomide.com: updated description to include full description]\nSigned-off-by: Tony Lindgren <tony@atomide.com>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/27dfdd5f927ba31f83a9ef1f6ef4ca6d7b3ce0b9"},{"sha":"714b4cac542e65868f4da5aedb86886a6a040873","author":{"email":"5db23874f34e45d59c69d81cd72d048d558566d7@gmail.com","name":"anarkia1976"},"message":"ARM: smp: Fix cpu_up() racing with sys_reboot","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/714b4cac542e65868f4da5aedb86886a6a040873"},{"sha":"9b08ff91e2d5d82ceb23ee0c9cfc7400f512f3df","author":{"email":"bca9775a3a89282973cc11b345f357144ac2c2b8@gmail.com","name":"Dan Trifan"},"message":"block: bigass squash of upstream commits\n\nthanx to faux123\n\nmake default readahead size a kernel parameter\n\nAdd new kernel parameter \"readahead\", which would be used instead of the\nvalue of VM_MAX_READAHEAD. If the parameter is not specified, the default\nof 128kb would be used.\n\nCC: Ankit Jain <radical@gmail.com>\nCC: Dave Chinner <david@fromorbit.com>\nCC: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>\nSigned-off-by: Nikanth Karthikesan <knikanth@suse.de>\nSigned-off-by: Wu Fengguang <fengguang.wu@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: limit default readahead size for small devices\n\nLinus reports a _really_ small & slow (505kB, 15kB/s) USB device,\non which blkid runs unpleasantly slow. He manages to optimize the blkid\nreads down to 1kB+16kB, but still kernel read-ahead turns it into 48kB.\n\n     lseek 0,    read 1024   => readahead 4 pages (start of file)\n     lseek 1536, read 16384  => readahead 8 pages (page contiguous)\n\nThe readahead heuristics involved here are reasonable ones in general.\nSo it's good to fix blkid with fadvise(RANDOM), as Linus already did.\n\nFor the kernel part, Linus suggests:\n  So maybe we could be less aggressive about read-ahead when the size of\n  the device is small? Turning a 16kB read into a 64kB one is a big deal,\n  when it's about 15% of the whole device!\n\nThis looks reasonable: smaller device tend to be slower (USB sticks as\nwell as micro/mobile/old hard disks).\n\nGiven that the non-rotational attribute is not always reported, we can\ntake disk size as a max readahead size hint. This patch uses a formula\nthat generates the following concrete limits:\n\n        disk size    readahead size\n     (scale by 4)      (scale by 2)\n               1M                8k\n               4M               16k\n              16M               32k\n              64M               64k\n             256M              128k\n        --------------------------- (*)\n               1G              256k\n               4G              512k\n              16G             1024k\n              64G             2048k\n             256G             4096k\n(*) Since the default readahead size is 128k, this limit only takes\neffect for devices whose size is less than 256M.\n\nThe formula is determined on the following data, collected by script:\n\n\t#!/bin/sh\n\n\t# please make sure BDEV is not mounted or opened by others\n\tBDEV=sdb\n\n\tfor rasize in 4 16 32 64 128 256 512 1024 2048 4096 8192\n\tdo\n\t\techo $rasize > /sys/block/$BDEV/queue/read_ahead_kb\n\t\ttime dd if=/dev/$BDEV of=/dev/null bs=4k count=102400\n\tdone\nThe principle is, the formula shall not limit readahead size to such a\ndegree that will impact some device's sequential read performance.\n\nThe Intel SSD is special in that its throughput increases steadily with\nlarger readahead size. However it may take years for Linux to increase\nits default readahead size to 2MB, so we don't take it seriously in the\nformula.\n\nSSD 80G Intel x25-M SSDSA2M080 (reported by Li Shaohua)\n\n\trasize\t1st run\t\t2nd run\n\t----------------------------------\n\t  4k\t123 MB/s\t122 MB/s\n\t 16k  \t153 MB/s\t153 MB/s\n\t 32k\t161 MB/s\t162 MB/s\n\t 64k\t167 MB/s\t168 MB/s\n\t128k\t197 MB/s\t197 MB/s\n\t256k\t217 MB/s\t217 MB/s\n\t512k\t238 MB/s\t234 MB/s\n\t  1M\t251 MB/s\t248 MB/s\n\t  2M\t259 MB/s\t257 MB/s\n==>\t  4M\t269 MB/s\t264 MB/s\n\t  8M\t266 MB/s\t266 MB/s\nNote that ==> points to the readahead size that yields plateau throughput.\n\nSSD 22G MARVELL SD88SA02 MP1F (reported by Jens Axboe)\n\n\trasize  1st             2nd\n\t--------------------------------\n\t  4k     41 MB/s         41 MB/s\n\t 16k     85 MB/s         81 MB/s\n\t 32k    102 MB/s        109 MB/s\n\t 64k    125 MB/s        144 MB/s\n\t128k    183 MB/s        185 MB/s\n\t256k    216 MB/s        216 MB/s\n\t512k    216 MB/s        236 MB/s\n\t1024k   251 MB/s        252 MB/s\n\t  2M    258 MB/s        258 MB/s\n==>       4M    266 MB/s        266 MB/s\n\t  8M    266 MB/s        266 MB/s\nSSD 30G SanDisk SATA 5000\n\n\t  4k\t29.6 MB/s\t29.6 MB/s\t29.6 MB/s\n\t 16k\t52.1 MB/s\t52.1 MB/s\t52.1 MB/s\n\t 32k\t61.5 MB/s\t61.5 MB/s\t61.5 MB/s\n\t 64k\t67.2 MB/s\t67.2 MB/s\t67.1 MB/s\n\t128k\t71.4 MB/s\t71.3 MB/s\t71.4 MB/s\n\t256k\t73.4 MB/s\t73.4 MB/s\t73.3 MB/s\n==>\t512k\t74.6 MB/s\t74.6 MB/s\t74.6 MB/s\n\t  1M\t74.7 MB/s\t74.6 MB/s\t74.7 MB/s\n\t  2M\t76.1 MB/s\t74.6 MB/s\t74.6 MB/s\n\nUSB stick 32G Teclast CoolFlash idVendor=1307, idProduct=0165\n\n\t  4k\t7.9 MB/s \t7.9 MB/s \t7.9 MB/s\n\t 16k\t17.9 MB/s\t17.9 MB/s\t17.9 MB/s\n\t 32k\t24.5 MB/s\t24.5 MB/s\t24.5 MB/s\n\t 64k\t28.7 MB/s\t28.7 MB/s\t28.7 MB/s\n\t128k\t28.8 MB/s\t28.9 MB/s\t28.9 MB/s\n==>\t256k\t30.5 MB/s\t30.5 MB/s\t30.5 MB/s\n\t512k\t30.9 MB/s\t31.0 MB/s\t30.9 MB/s\n\t  1M\t31.0 MB/s\t30.9 MB/s\t30.9 MB/s\n\t  2M\t30.9 MB/s\t30.9 MB/s\t30.9 MB/s\n\nUSB stick 4G SanDisk  Cruzer idVendor=0781, idProduct=5151\n\n\t  4k\t6.4 MB/s \t6.4 MB/s \t6.4 MB/s\n\t 16k\t13.4 MB/s\t13.4 MB/s\t13.2 MB/s\n\t 32k\t17.8 MB/s\t17.9 MB/s\t17.8 MB/s\n\t 64k\t21.3 MB/s\t21.3 MB/s\t21.2 MB/s\n\t128k\t21.4 MB/s\t21.4 MB/s\t21.4 MB/s\n==>\t256k\t23.3 MB/s\t23.2 MB/s\t23.2 MB/s\n\t512k\t23.3 MB/s\t23.8 MB/s\t23.4 MB/s\n\t  1M\t23.8 MB/s\t23.4 MB/s\t23.3 MB/s\n\t  2M\t23.4 MB/s\t23.2 MB/s\t23.4 MB/s\n\nUSB stick 2G idVendor=0204, idProduct=6025 SerialNumber: 08082005000113\n\n\t  4k\t6.7 MB/s \t6.9 MB/s \t6.7 MB/s\n\t 16k\t11.7 MB/s\t11.7 MB/s\t11.7 MB/s\n\t 32k\t12.4 MB/s\t12.4 MB/s\t12.4 MB/s\n   \t 64k\t13.4 MB/s\t13.4 MB/s\t13.4 MB/s\n\t128k\t13.4 MB/s\t13.4 MB/s\t13.4 MB/s\n==>\t256k\t13.6 MB/s\t13.6 MB/s\t13.6 MB/s\n\t512k\t13.7 MB/s\t13.7 MB/s\t13.7 MB/s\n\t  1M\t13.7 MB/s\t13.7 MB/s\t13.7 MB/s\n\t  2M\t13.7 MB/s\t13.7 MB/s\t13.7 MB/s\n\n64 MB, USB full speed (collected by Clemens Ladisch)\nBus 003 Device 003: ID 08ec:0011 M-Systems Flash Disk Pioneers DiskOnKey\n\n\t4KB:    139.339 s, 376 kB/s\n\t16KB:   81.0427 s, 647 kB/s\n\t32KB:   71.8513 s, 730 kB/s\n==>\t64KB:   67.3872 s, 778 kB/s\n\t128KB:  67.5434 s, 776 kB/s\n\t256KB:  65.9019 s, 796 kB/s\n\t512KB:  66.2282 s, 792 kB/s\n\t1024KB: 67.4632 s, 777 kB/s\n\t2048KB: 69.9759 s, 749 kB/s\n\nAn unnamed SD card (Yakui):\n\n         4k     195.873 s,  5.5 MB/s\n         8k     123.425 s,  8.7 MB/s\n         16k    86.6425 s, 12.4 MB/s\n         32k    66.7519 s, 16.1 MB/s\n==>      64k    58.5262 s, 18.3 MB/s\n         128k   59.3847 s, 18.1 MB/s\n         256k   59.3188 s, 18.1 MB/s\n         512k   59.0218 s, 18.2 MB/s\n\nCC: Li Shaohua <shaohua.li@intel.com>\nCC: Clemens Ladisch <clemens@ladisch.de>\nAcked-by: Jens Axboe <jens.axboe@oracle.com>\nAcked-by: Rik van Riel <riel@redhat.com>\nTested-by: Vivek Goyal <vgoyal@redhat.com>\nTested-by: Linus Torvalds <torvalds@linux-foundation.org>\nSigned-off-by: Wu Fengguang <fengguang.wu@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix deadlock through percpu allocation in blk-cgroup\n\nPercpu allocator depends on %GFP_KERNEL allocation and can't be used\nfor NOIO or NOFS allocations; unfortunately, blk-cgroup allocates\npercpu stats structure in the IO path, which triggers the following\nlockdep warning and also leads to actual deadlocks under certain\nconditions.\n\n inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.\n qemu-kvm/8774 [HC0[0]:SC0[0]:HE1:SE1] takes:\n  (pcpu_alloc_mutex){+.+.?.}, at: [<ffffffff8110c8be>] pcpu_alloc+0x6f/0x835\n {RECLAIM_FS-ON-W} state was registered at:\n   [<ffffffff8108f85a>] mark_held_locks+0x6d/0x95\n   [<ffffffff8108fe69>] lockdep_trace_alloc+0x9f/0xc2\n   [<ffffffff8112d781>] slab_pre_alloc_hook+0x1e/0x54\n   [<ffffffff8112fcf9>] __kmalloc+0x64/0x10c\n   [<ffffffff8110bec8>] pcpu_mem_alloc+0x5e/0x67\n   [<ffffffff8110c169>] pcpu_extend_area_map+0x2b/0xd4\n   [<ffffffff8110ca0d>] pcpu_alloc+0x1be/0x835\n   [<ffffffff8110d094>] __alloc_percpu+0x10/0x12\n   [<ffffffff8113167a>] kmem_cache_open+0x2cc/0x2d6\n   [<ffffffff8113185d>] kmem_cache_create+0x1d9/0x281\n   [<ffffffff812971a5>] acpi_os_create_cache+0x1d/0x2d\n   [<ffffffff812bf742>] acpi_ut_create_caches+0x26/0xb0\n   [<ffffffff812c2106>] acpi_ut_init_globals+0xe/0x244\n   [<ffffffff81d82ca9>] acpi_initialize_subsystem+0x35/0xae\n   [<ffffffff81d819c2>] acpi_early_init+0x5c/0xf7\n   [<ffffffff81d51be9>] start_kernel+0x3ce/0x3ea\n   [<ffffffff81d512c4>] x86_64_start_reservations+0xaf/0xb3\n   [<ffffffff81d51412>] x86_64_start_kernel+0x14a/0x159\n irq event stamp: 48683649\n hardirqs last  enabled at (48683649): [<ffffffff814fd547>] __slab_alloc+0x413/0x434\n hardirqs last disabled at (48683648): [<ffffffff814fd17c>] __slab_alloc+0x48/0x434\n softirqs last  enabled at (48683630): [<ffffffff810630bf>] __do_softirq+0x200/0x25a\n softirqs last disabled at (48683625): [<ffffffff8150debc>] call_softirq+0x1c/0x30\n other info that might help us debug this:\n  Possible unsafe locking scenario:\n\n        CPU0\n        ----\n   lock(pcpu_alloc_mutex);\n   <Interrupt>\n     lock(pcpu_alloc_mutex);\n  *** DEADLOCK ***\n\n 3 locks held by qemu-kvm/8774:\n  #0:  (&vcpu->mutex){+.+.+.}, at: [<ffffffffa005d979>] vcpu_load+0x1d/0x90 [kvm]\n  #1:  (&kvm->srcu){.+.+.+}, at: [<ffffffffa00663f7>] srcu_read_lock+0x0/0x49 [kvm]\n  #2:  (&mm->mmap_sem){++++++}, at: [<ffffffffa005ee6f>] hva_to_pfn+0xbb/0x2d1 [kvm]\n stack backtrace:\n Pid: 8774, comm: qemu-kvm Not tainted 3.1.4 #2\n Call Trace:\n  [<ffffffff814fa906>] print_usage_bug+0x1e7/0x1f8\n  [<ffffffff8108e232>] mark_lock+0x106/0x220\n  [<ffffffff8108e6ee>] __lock_acquire+0x3a2/0xd0c\n  [<ffffffff8108f55b>] lock_acquire+0xf3/0x13e\n  [<ffffffff815030ad>] __mutex_lock_common+0x5d/0x39a\n  [<ffffffff815034f9>] mutex_lock_nested+0x40/0x45\n  [<ffffffff8110c8be>] pcpu_alloc+0x6f/0x835\n  [<ffffffff8110d094>] __alloc_percpu+0x10/0x12\n  [<ffffffff8123d64c>] blkio_alloc_blkg_stats+0x1d/0x31\n  [<ffffffff8123ed87>] throtl_alloc_tg+0x3a/0xdf\n  [<ffffffff8123f79f>] blk_throtl_bio+0x154/0x39c\n  [<ffffffff81231c52>] generic_make_request+0x2e4/0x415\n  [<ffffffff81231e61>] submit_bio+0xde/0xfd\n  [<ffffffff8111e15d>] swap_writepage+0x94/0x9f\n  [<ffffffff811041d1>] shmem_writepage+0x192/0x1d8\n  [<ffffffff8110167b>] shrink_page_list+0x402/0x79a\n  [<ffffffff81101e1a>] shrink_inactive_list+0x22c/0x3df\n  [<ffffffff811026b2>] shrink_zone+0x43f/0x582\n  [<ffffffff81102b5e>] do_try_to_free_pages+0x107/0x318\n  [<ffffffff811030a6>] try_to_free_pages+0xd5/0x175\n  [<ffffffff810f9021>] __alloc_pages_nodemask+0x535/0x7eb\n  [<ffffffff81127f02>] alloc_pages_vma+0xf5/0xfa\n  [<ffffffff81136bfb>] do_huge_pmd_anonymous_page+0xb3/0x274\n  [<ffffffff811112f2>] handle_mm_fault+0xfd/0x1b8\n  [<ffffffff8111173c>] __get_user_pages+0x2fa/0x465\n  [<ffffffffa005edb2>] get_user_page_nowait+0x37/0x39 [kvm]\n  [<ffffffffa005ee8a>] hva_to_pfn+0xd6/0x2d1 [kvm]\n  [<ffffffffa005f108>] __gfn_to_pfn+0x83/0x8c [kvm]\n  [<ffffffffa005f1c9>] gfn_to_pfn_async+0x1a/0x1c [kvm]\n  [<ffffffffa007799e>] try_async_pf+0x3f/0x248 [kvm]\n  [<ffffffffa0079140>] tdp_page_fault+0xe8/0x1a5 [kvm]\n  [<ffffffffa0077c83>] kvm_mmu_page_fault+0x2b/0x83 [kvm]\n  [<ffffffffa00cda71>] handle_ept_violation+0xe1/0xea [kvm_intel]\n  [<ffffffffa00d2129>] vmx_handle_exit+0x5ee/0x638 [kvm_intel]\n  [<ffffffffa007153f>] kvm_arch_vcpu_ioctl_run+0xb30/0xe00 [kvm]\n  [<ffffffffa005db4f>] kvm_vcpu_ioctl+0x120/0x59c [kvm]\n  [<ffffffff811502a5>] do_vfs_ioctl+0x472/0x4b3\n  [<ffffffff8115033c>] sys_ioctl+0x56/0x7a\n  [<ffffffff8150bbc2>] system_call_fastpath+0x16/0x1b\nFor more details, please refer to the following thread.\n\n  http://thread.gmane.org/gmane.comp.emulators.kvm.devel/82755\n\nThis patch fixes the bug by using percpu_mempool to allocate blkg\npercpu stats.  As the allocations are only per cgroup - request_queue\npair, they aren't expected to be frequent.  Use smallish pool of 8\nelements which is refilled once half is consumed.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nReported-by: Avi Kivity <avi@redhat.com>\nReported-by: Nate Custer <nate@cpanel.net>\nCc: Christoph Lameter <cl@linux-foundation.org>\nCc: Andrew Morton <akpm@linux-foundation.org>\nCc: Oleg Nesterov <oleg@redhat.com>\nCc: Jens Axboe <axboe@kernel.dk>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: avoid building too big plug list\n\nWhen I test fio script with big I/O depth, I found the total throughput drops\ncompared to some relative small I/O depth. The reason is the thread accumulates\nbig requests in its plug list and causes some delays (surely this depends\non CPU speed).\nI thought we'd better have a threshold for requests. When a threshold reaches,\nthis means there is no request merge and queue lock contention isn't severe\nwhen pushing per-task requests to queue, so the main advantages of blk plug\ndon't exist. We can force a plug list flush in this case.\nWith this, my test throughput actually increases and almost equals to small\nI/O depth. Another side effect is irq off time decreases in blk_flush_plug_list()\nfor big I/O depth.\nThe BLK_MAX_REQUEST_COUNT is choosen arbitarily, but 16 is efficiently to\nreduce lock contention to me. But I'm open here, 32 is ok in my test too.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: simplify force plug flush code a little bit\n\nCleaning up the code a little bit. attempt_plug_merge() traverses the plug\nlist anyway, we can do the request counting there, so stack size is reduced\na little bit.\nThe motivation here is I suspect if we should count the requests for each\nqueue (task could handle multiple disks in the meantime), but my test doesn't\nshow it's worthy doing. If somebody proves we should do it, below change\nwill make that more easier.\n\nSigned-off-by: Shaohua Li <shli@kernel.org>\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nmerged conflict resolved by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, sx8: kill blk_insert_request()\n\nThe only user left for blk_insert_request() is sx8 and it can be\ntrivially switched to use blk_execute_rq_nowait() - special requests\naren't included in io stat and sx8 doesn't use block layer tagging.\nSwitch sx8 and kill blk_insert_requeset().\n\nThis patch doesn't introduce any functional difference.\n\nOnly compile tested.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nAcked-by: Jeff Garzik <jgarzik@pobox.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: avoid unnecessary plug list flush\n\nget_request_wait() could sleep and flush the plug list.  If the list is\nalready flushed, don't flush again.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nReviewed-by: Namhyung Kim <namhyung@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nfixlet: Remove fs_excl from struct task.\n\nfs_excl is a poor man's priority inheritance for filesystems to hint to\nthe block layer that an operation is important. It was never clearly\nspecified, not widely adopted, and will not prevent starvation in many\ncases (like across cgroups).\n\nfs_excl was introduced with the time sliced CFQ IO scheduler, to\nindicate when a process held FS exclusive resources and thus needed\na boost.\n\nIt doesn't cover all file systems, and it was never fully complete.\nLets kill it.\n\nSigned-off-by: Justin TerAvest <teravest@google.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nCFQ: move think time check variables to a separate struct\n\nMove the variables to do think time check to a sepatate struct. This is\nto prepare adding think time check for service tree and group. No\nfunctional change.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nAcked-by: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nCFQ: add think time check for service tree\n\nCurrently when the last queue of a service tree has no request, we don't\nexpire the queue to hope request from the service tree comes soon, so the\nservice tree doesn't miss its share. But if the think time is big, the\nassumption isn't correct and we just waste bandwidth. In such case, we\ndon't do idle.\n\n[global]\nruntime=10\ndirect=1\n\n[test1]\nrw=randread\nioengine=libaio\nsize=500m\ndirectory=/mnt\nfilename=file1\nthinktime=9000\n\n[test2]\nrw=read\nioengine=libaio\nsize=1G\ndirectory=/mnt\nfilename=file2\n\n\tpatched\t\tbase\ntest1\t41k/s\t\t33k/s\ntest2\t15868k/s\t15789k/s\ntotal\t15902k/s\t15817k/s\n\nA slightly better\n\nTo check if the patch changes behavior of queue without think time. I also\ntried to give test1 2ms think time or no think time. The test has variation\neven without the patch, but the average throughput doesn't change with/without\nthe patch.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nAcked-by: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nCFQ: add think time check for group\n\nCurrently when the last queue of a group has no request, we don't expire\nthe queue to hope request from the group comes soon, so the group doesn't\nmiss its share. But if the think time is big, the assumption isn't correct\nand we just waste bandwidth. In such case, we don't do idle.\n\n[global]\nruntime=30\ndirect=1\n\n[test1]\ncgroup=test1\ncgroup_weight=1000\nrw=randread\nioengine=libaio\nsize=500m\nruntime=30\ndirectory=/mnt\nfilename=file1\nthinktime=9000\n\n[test2]\ncgroup=test2\ncgroup_weight=1000\nrw=randread\nioengine=libaio\nsize=500m\nruntime=30\ndirectory=/mnt\nfilename=file2\n\n\tpatched\t\tbase\ntest1\t64k\t\t39k\ntest2\t548k\t\t540k\ntotal\t604k\t\t578k\n\ngroup1 gets much better throughput because it waits less time.\n\nTo check if the patch changes behavior of queue without think time. I also\ntried to give test1 2ms think time or no think time. The test result is stable.\nThe thoughput doesn't change with/without the patch.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nAcked-by: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\ncfq-iosched: Reduce linked group count upon group destruction\n\nFQ keeps track of number of groups which are linked on blkcg->blkg_list.\nThis is useful to avoid races between queue exit and cgroup exit code\npaths. So if at the request queue exit time linked group count is not\nzero, that means there are some group out there which is yet to be\ndeleted under rcu read period and queue exit code should wait for\non rcu period.\n\nIn my previous patch I forgot to decrease the number of group count.\nSo in current form, we nr_blkcg_linked_grps is always non-zero and\nwe will always wait one rcu period (if BLK_CGROUP=y). The side effect\nof this is that it can increase boot time. I am surprised, nobody\ncomplained so far.\n\nSigned-off-by: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: separate priority boosting from REQ_META\n\nAdd a new REQ_PRIO to let requests preempt others in the cfq I/O schedule,\nand lave REQ_META purely for marking requests as metadata in blktrace.\n\nAll existing callers of REQ_META except for XFS are updated to also\nset REQ_PRIO for now.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\nReviewed-by: Namhyung Kim <namhyung@gmail.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nmerged conflicts resolved by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: Invalidate the cache for a parent block-device if blkdev_issue_flush()\nwas called for a partition\n\nExecuting a BLKFLSBUF-ioctl on a partition flushes the caches for that\npartition but reading data through the parent device will still return\nthe old cached data.\n\nThe cache for the block-device is not synced if the block-device is kept\nopen (due to a mounted partition, for example). Only when all users for\nthe disk have exited, the cache for the disk is made consistent again.\n\nCalling invalidate_bdev() on the parent block-device in case\nblkdev_issue_flush() was called for a partition fixes this.\n\nThe problem can be worked around by forcing the caches to be flushed\nwith either\n\t# blockdev --flushbufs ${dev_disk}\nor\n\t# echo 3 > /proc/sys/vm/drop_caches\nCC: Bryn M. Reeves <bmr@redhat.com>\nSigned-off-by: Niels de Vos <ndevos@redhat.com>\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: add GENHD_FL_NO_PART_SCAN\n\nThere are cases where suppressing partition scan is useful - e.g. for\nlo devices and pseudo SATA devices which advertise to be a disk but\nget upset on partition scan (some port multiplier control devices show\nsuch behavior).\n\nThis patch adds GENHD_FL_NO_PART_SCAN which suppresses partition scan\nregardless of the number of possible partitions.  disk_partitionable()\nis renamed to disk_part_scan_enabled() as suppressing partition scan\ndoesn't imply the device can't be partitioned using\nBLKPG_ADD/DEL_PARTITION calls from userland.  show_partition() now\ndirectly tests disk_max_parts() to maintain backward-compatibility.\n\n-v2: Updated to make it clear that only partition scan is suppressed\n     not partitioning itself as suggested by Kay Sievers.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Kay Sievers <kay.sievers@vrfy.org>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: strict rq_affinity\n\nSome systems benefit from completions always being steered to the strict\nrequester cpu rather than the looser \"per-socket\" steering that\nblk_cpu_to_group() attempts by default. This is because the first\nCPU in the group mask ends up being completely overloaded with work,\nwhile the others (including the original submitter) has power left\nto spare.\n\nAllow the strict mode to be set by writing '2' to the sysfs control\nfile. This is identical to the scheme used for the nomerges file,\nwhere '2' is a more aggressive setting than just being turned on.\n\necho 2 > /sys/block/<bdev>/queue/rq_affinity\n\nCc: Christoph Hellwig <hch@infradead.org>\nCc: Roland Dreier <roland@purestorage.com>\nTested-by: Dave Jiang <dave.jiang@intel.com>\nSigned-off-by: Dan Williams <dan.j.williams@intel.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: Fix queue_flag update when rq_affinity goes from 2 to 1\n\nCommit 5757a6d76cdf added the QUEUE_FLAG_SAME_FORCE flag, but fails to\nclear that flag when the current state is '2' (SAME_COMP + SAME_FORCE)\nand the new state is '1' (SAME_COMP).\n\nAcked-by: Dan Williams <dan.j.williams@intel.com>\nReviewed-by: Roland Dreier <roland@purestorage.com>\nSigned-off-by: Eric Seppanen <eric@purestorage.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: change force plug flush call order\n\nDo blk_flush_plug_list() first and then add new request aDo blk_flush_plug_list() first and then add new request aDo blk_flush_plug_list() first and then add new request at the tail. New\nrequest can't be merged to existing requests, but later new requests might\nbe merged with this new one. If blk_flush_plug_list() is done later, the\nmerge doesn't happen.\nBelieve it or not, this fixes a 10% regression running sysbench workload.\n\nSigned-off-by: Shaohua Li <shli@kernel.org>\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: simplify force plug flush code a little bit\n\nCleaning up the code a little bit. attempt_plug_merge() traverses the plug\nlist anyway, we can do the request counting there, so stack size is reduced\na little bit.\nThe motivation here is I suspect if we should count the requests for each\nqueue (task could handle multiple disks in the meantime), but my test doesn't\nshow it's worthy doing. If somebody proves we should do it, below change\nwill make that more easier.\n\nSigned-off-by: Shaohua Li <shli@kernel.org>\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nelevator: use ELV_NAME_MAX instead of magic number 16 for chosen_elevator\n\nWe have ELV_NAME_MAX defined to 16, and hence we should use it\ninstead of the magic nubmer 16 for elevator's name string.\n\nSigned-off-by: Wang Sheng-Hui <shhuiw@gmail.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: export __make_request\n\nAvoid the hacks need for request based device mappers currently by simply\nexporting the symbol instead of trying to get it through the back door.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: rename __make_request() to blk_queue_bio()\n\nNow that it's exported, lets put it in a more sane namespace.\n\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix warning with calling smp_processor_id() in preemptible section\n\nAfter commit 5757a6d7 introduced an unsafe calling of\nsmp_processor_id(), with preempt debuggin turned on we spew a lot of:\n\nBUG: using smp_processor_id() in preemptible [00000000] code: kjournald/514\ncaller is __make_request+0x1b8/0x308\n[<c0019f44>] (unwind_backtrace+0x0/0xe8) from [<c024b4cc>] (debug_smp_processor_id+0xbc/0xf0)\n[<c024b4cc>] (debug_smp_processor_id+0xbc/0xf0) from [<c0223d14>] (__make_request+0x1b8/0x308)\n[<c0223d14>] (__make_request+0x1b8/0x308) from [<c02215ac>] (generic_make_request+0x4dc/0x558)\n[<c02215ac>] (generic_make_request+0x4dc/0x558) from [<c022173c>] (submit_bio+0x114/0x138)\n[<c022173c>] (submit_bio+0x114/0x138) from [<c011f504>] (submit_bh+0x148/0x16c)\n[<c011f504>] (submit_bh+0x148/0x16c) from [<c0121ed8>] (__sync_dirty_buffer+0x88/0xd8)\n[<c0121ed8>] (__sync_dirty_buffer+0x88/0xd8) from [<c01aff78>] (journal_commit_transaction+0x1198/0x1688)\n[<c01aff78>] (journal_commit_transaction+0x1198/0x1688) from [<c01b4034>] (kjournald+0xb4/0x224)\n[<c01b4034>] (kjournald+0xb4/0x224) from [<c0069ea0>] (kthread+0x8c/0x94)\n[<c0069ea0>] (kthread+0x8c/0x94) from [<c00137f8>] (kernel_thread_exit+0x0/0x8)\n\nFix this by just using raw_smp_processor_id(), it's just a hint\nafter all. There's no pinning of the CPU or accessing per-cpu\nstructures involved.\n\nReported-by: Ming Lei <tom.leiming@gmail.com>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nfail_make_request: cleanup should_fail_request\n\nThis changes should_fail_request() to more usable wrapper function of\nshould_fail().  It can avoid putting #ifdef CONFIG_FAIL_MAKE_REQUEST in\nthe middle of a function.\n\nSigned-off-by: Akinobu Mita <akinobu.mita@gmail.com>\nCc: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: remove support for bio remapping from ->make_request\n\nThere is very little benefit in allowing to let a ->make_request\ninstance update the bios device and sector and loop around it in\n__generic_make_request when we can archive the same through calling\ngeneric_make_request from the driver and letting the loop in\ngeneric_make_request handle it.\n\nNote that various drivers got the return value from ->make_request and\nreturned non-zero values for errors.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\nAcked-by: NeilBrown <neilb@suse.de>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\n\tblock/blk-core.c\n\tdrivers/md/raid1.c\n\tdrivers/md/raid10.c\n\tdrivers/staging/zram/zram_drv.c\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\tdrivers/block/umem.c\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: Don't check QUEUE_FLAG_SAME_COMP in __blk_complete_request\n\nIn __blk_complete_request, we check both QUEUE_FLAG_SAME_COMP and req->cpu\nto decide whether we should use req->cpu. Actually the user can also\nselect the complete cpu by either setting BIO_CPU_AFFINE or by calling\nbio_set_completion_cpu. Current solution makes these 2 ways don't work\nany more. So we'd better just check req->cpu.\n\nSigned-off-by: Tao Ma <boyu.mt@taobao.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: refactor generic_make_request\n\nMove all the checks performed on a bio into a new helper, and call it as\nsoon as bio is submitted even if it is a re-submission from ->make_request.\n\nWe explicitly mark the new helper as beeing non-inlined as the stack\nusage for printing the block device name in the failure case is quite\nhigh and this a patch where we have to be extremely conservative about\nstack usage.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: document blk-plug\n\nThus spake Andrew Morton:\n\n\"And I have the usual maintainability whine.  If someone comes up to\nvmscan.c and sees it calling blk_start_plug(), how are they supposed to\nwork out why that call is there?  They go look at the blk_start_plug()\ndefinition and it is undocumented.  I think we can do better than this?\"\n\nAdapted from the LWN article - http://lwn.net/Articles/438256/ by Jens\nAxboe and from an earlier attempt by Shaohua Li to document blk-plug.\n\n[akpm@linux-foundation.org: grammatical and spelling tweaks]\nSigned-off-by: Suresh Jayaraman <sjayaraman@suse.de>\nCc: Shaohua Li <shaohua.li@intel.com>\nCc: Jonathan Corbet <corbet@lwn.net>\nSigned-off-by: Andrew Morton <akpm@google.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\n\tinclude/linux/blkdev.h\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\tinclude/linux/blkdev.h\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock/blk-sysfs.c: fix kerneldoc references\n\nThe kerneldoc for blk_release_queue() is referring to blk_cleanup_queue().\n\nCc: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Andrew Morton <akpm@google.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix genhd refcounting in blkio_policy_parse_and_set()\n\nblkio_policy_parse_and_set() calls blkio_check_dev_num() to check\nwhether the given dev_t is valid.  blkio_check_dev_num() uses\nget_gendisk() for verification but never puts the returned genhd\nleaking the reference.\n\nThis patch collapses blkio_check_dev_num() into its caller and updates\nit such that the genhd is put before returning.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: move blk_throtl prototypes to block/blk.h\n\nblk_throtl interface is block internal and there's no reason to have\nthem in linux/blkdev.h.  Move them to block/blk.h.\n\nThis patch doesn't introduce any functional change.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: pass around REQ_* flags instead of broken down booleans during request alloc/free\n\nblk_alloc_request() and freed_request() take different combinations of\nREQ_* @flags, @priv and @is_sync when @flags is superset of the latter\ntwo.  Make them take @flags only.  This cleans up the code a bit and\nwill ease updating allocation related REQ_* flags.\n\nThis patch doesn't introduce any functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: drop unnecessary blk_get/put_queue() in scsi_cmd_ioctl() and blk_get_tg()\n\nblk_get/put_queue() in scsi_cmd_ioctl() and throtl_get_tg() are\ncompletely bogus.  The caller must have a reference to the queue on\nentry and taking an extra reference doesn't change anything.\n\nFor scsi_cmd_ioctl(), the only effect is that it ends up checking\nQUEUE_FLAG_DEAD on entry; however, this is bogus as queue can die\nright after blk_get_queue().  Dead queue should be and is handled in\nrequest issue path (it's somewhat broken now but that's a separate\nproblem and doesn't affect this one much).\n\nthrotl_get_tg() incorrectly assumes that q is rcu freed.  Also, it\ndoesn't check return value of blk_get_queue().  If the queue is\nalready dead, it ends up doing an extra put.\n\nDrop them.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: reorganize queue draining\n\nReorganize queue draining related code in preparation of queue exit\nchanges.\n\n* Factor out actual draining from elv_quiesce_start() to\n  blk_drain_queue().\n\n* Make elv_quiesce_start/end() responsible for their own locking.\n\n* Replace open-coded ELVSWITCH clearing in elevator_switch() with\n  elv_quiesce_end().\n\nThis patch doesn't cause any visible functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: reorganize throtl_get_tg() and blk_throtl_bio()\n\nblk_throtl_bio() and throtl_get_tg() have rather unusual interface.\n\n* throtl_get_tg() returns pointer to a valid tg or ERR_PTR(-ENODEV),\n  and drops queue_lock in the latter case.  Different locking context\n  depending on return value is error-prone and DEAD state is scheduled\n  to be protected by queue_lock anyway.  Move DEAD check inside\n  queue_lock and return valid tg or NULL.\n\n* blk_throtl_bio() indicates return status both with its return value\n  and in/out param **@bio.  The former is used to indicate whether\n  queue is found to be dead during throtl processing.  The latter\n  whether the bio is throttled.\n\n  There's no point in returning DEAD check result from\n  blk_throtl_bio().  The queue can die after blk_throtl_bio() is\n  finished but before make_request_fn() grabs queue lock.\n\n  Make it take *@bio instead and return boolean result indicating\n  whether the request is throttled or not.\n\nThis patch doesn't cause any visible functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: make get_request[_wait]() fail if queue is dead\n\nCurrently get_request[_wait]() allocates request whether queue is dead\nor not.  This patch makes get_request[_wait]() return NULL if @q is\ndead.  blk_queue_bio() is updated to fail the submitted bio if request\nallocation fails.  While at it, add docbook comments for\nget_request[_wait]().\n\nNote that the current code has rather unclear (there are spurious DEAD\ntests scattered around) assumption that the owner of a queue\nguarantees that no request travels block layer if the queue is dead\nand this patch in itself doesn't change much; however, this will allow\nfixing the broken assumption in the next patch.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: drop @tsk from attempt_plug_merge() and explain sync rules\n\nattempt_plug_merge() accesses elevator without holding queue_lock and\nmay call into ->elevator_bio_merge_fn().  The elvator is guaranteed to\nbe valid because it's accessed iff the plugged list has requests and\nelevator is never exited with live requests, so as long as the\nelevator method can deal with unlocked access, this is safe.\n\nExplain the sync rules around attempt_plug_merge() and drop the\nunnecessary @tsk parameter.\n\nThis patch doesn't introduce any functional change.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix request_queue lifetime handling by making blk_queue_cleanup() properly shutdown\n\nrequest_queue is refcounted but actually depdends on lifetime\nmanagement from the queue owner - on blk_cleanup_queue(), block layer\nexpects that there's no request passing through request_queue and no\nnew one will.\n\nThis is fundamentally broken.  The queue owner (e.g. SCSI layer)\ndoesn't have a way to know whether there are other active users before\ncalling blk_cleanup_queue() and other users (e.g. bsg) don't have any\nguarantee that the queue is and would stay valid while it's holding a\nreference.\n\nWith delay added in blk_queue_bio() before queue_lock is grabbed, the\nfollowing oops can be easily triggered when a device is removed with\nin-flight IOs.\n\n sd 0:0:1:0: [sdb] Stopping disk\n ata1.01: disabled\n general protection fault: 0000 [#1] PREEMPT SMP\n CPU 2\n Modules linked in:\n\n Pid: 648, comm: test_rawio Not tainted 3.1.0-rc3-work+ #56 Bochs Bochs\n RIP: 0010:[<ffffffff8137d651>]  [<ffffffff8137d651>] elv_rqhash_find+0x61/0x100\n ...\n Process test_rawio (pid: 648, threadinfo ffff880019efa000, task ffff880019ef8a80)\n ...\n Call Trace:\n  [<ffffffff8137d774>] elv_merge+0x84/0xe0\n  [<ffffffff81385b54>] blk_queue_bio+0xf4/0x400\n  [<ffffffff813838ea>] generic_make_request+0xca/0x100\n  [<ffffffff81383994>] submit_bio+0x74/0x100\n  [<ffffffff811c53ec>] dio_bio_submit+0xbc/0xc0\n  [<ffffffff811c610e>] __blockdev_direct_IO+0x92e/0xb40\n  [<ffffffff811c39f7>] blkdev_direct_IO+0x57/0x60\n  [<ffffffff8113b1c5>] generic_file_aio_read+0x6d5/0x760\n  [<ffffffff8118c1ca>] do_sync_read+0xda/0x120\n  [<ffffffff8118ce55>] vfs_read+0xc5/0x180\n  [<ffffffff8118cfaa>] sys_pread64+0x9a/0xb0\n  [<ffffffff81afaf6b>] system_call_fastpath+0x16/0x1b\n\nThis happens because blk_queue_cleanup() destroys the queue and\nelevator whether IOs are in progress or not and DEAD tests are\nsprinkled in the request processing path without proper\nsynchronization.\n\nSimilar problem exists for blk-throtl.  On queue cleanup, blk-throtl\nis shutdown whether it has requests in it or not.  Depending on\ntiming, it either oopses or throttled bios are lost putting tasks\nwhich are waiting for bio completion into eternal D state.\n\nThe way it should work is having the usual clear distinction between\nshutdown and release.  Shutdown drains all currently pending requests,\nmarks the queue dead, and performs partial teardown of the now\nunnecessary part of the queue.  Even after shutdown is complete,\nreference holders are still allowed to issue requests to the queue\nalthough they will be immmediately failed.  The rest of teardown\nhappens on release.\n\nThis patch makes the following changes to make blk_queue_cleanup()\nbehave as proper shutdown.\n\n* QUEUE_FLAG_DEAD is now set while holding both q->exit_mutex and\n  queue_lock.\n\n* Unsynchronized DEAD check in generic_make_request_checks() removed.\n  This couldn't make any meaningful difference as the queue could die\n  after the check.\n\n* blk_drain_queue() updated such that it can drain all requests and is\n  now called during cleanup.\n\n* blk_throtl updated such that it checks DEAD on grabbing queue_lock,\n  drains all throttled bios during cleanup and free td when queue is\n  released.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix a typo in the blk-cgroup.h file\n\nbyptes -> bytes.\n\nSigned-off-by: Jie Liu <jeff.liu@oracle.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: Remove the control of complete cpu from bio.\n\nbio originally has the functionality to set the complete cpu, but\nit is broken.\n\nChirstoph said that \"This code is unused, and from the all the\ndiscussions lately pretty obviously broken.  The only thing keeping\nit serves is creating more confusion and possibly more bugs.\"\n\nAnd Jens replied with \"We can kill bio_set_completion_cpu(). I'm fine\nwith leaving cpu control to the request based drivers, they are the\nonly ones that can toggle the setting anyway\".\n\nSo this patch tries to remove all the work of controling complete cpu\nfrom a bio.\n\nCc: Shaohua Li <shaohua.li@intel.com>\nCc: Christoph Hellwig <hch@infradead.org>\nSigned-off-by: Tao Ma <boyu.mt@taobao.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix flush machinery for stacking drivers with differring flush flags\n\nCommit ae1b1539622fb46e51b4d13b3f9e5f4c713f86ae, block: reimplement\nFLUSH/FUA to support merge, introduced a performance regression when\nrunning any sort of fsyncing workload using dm-multipath and certain\nstorage (in our case, an HP EVA).  The test I ran was fs_mark, and it\ndropped from ~800 files/sec on ext4 to ~100 files/sec.  It turns out\nthat dm-multipath always advertised flush+fua support, and passed\ncommands on down the stack, where those flags used to get stripped off.\nThe above commit changed that behavior:\n\nstatic inline struct request *__elv_next_request(struct request_queue *q)\n{\n        struct request *rq;\n\n        while (1) {\n-               while (!list_empty(&q->queue_head)) {\n+               if (!list_empty(&q->queue_head)) {\n                        rq = list_entry_rq(q->queue_head.next);\n-                       if (!(rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) ||\n-                           (rq->cmd_flags & REQ_FLUSH_SEQ))\n-                               return rq;\n-                       rq = blk_do_flush(q, rq);\n-                       if (rq)\n-                               return rq;\n+                       return rq;\n                }\n\nNote that previously, a command would come in here, have\nREQ_FLUSH|REQ_FUA set, and then get handed off to blk_do_flush:\n\nstruct request *blk_do_flush(struct request_queue *q, struct request *rq)\n{\n        unsigned int fflags = q->flush_flags; /* may change, cache it */\n        bool has_flush = fflags & REQ_FLUSH, has_fua = fflags & REQ_FUA;\n        bool do_preflush = has_flush && (rq->cmd_flags & REQ_FLUSH);\n        bool do_postflush = has_flush && !has_fua && (rq->cmd_flags &\n        REQ_FUA);\n        unsigned skip = 0;\n...\n        if (blk_rq_sectors(rq) && !do_preflush && !do_postflush) {\n                rq->cmd_flags &= ~REQ_FLUSH;\n\t\tif (!has_fua)\n\t\t\trq->cmd_flags &= ~REQ_FUA;\n\t        return rq;\n\t}\n\nSo, the flush machinery was bypassed in such cases (q->flush_flags == 0\n&& rq->cmd_flags & (REQ_FLUSH|REQ_FUA)).\n\nNow, however, we don't get into the flush machinery at all.  Instead,\n__elv_next_request just hands a request with flush and fua bits set to\nthe scsi_request_fn, even if the underlying request_queue does not\nsupport flush or fua.\n\nThe agreed upon approach is to fix the flush machinery to allow\nstacking.  While this isn't used in practice (since there is only one\nrequest-based dm target, and that target will now reflect the flush\nflags of the underlying device), it does future-proof the solution, and\nmake it function as designed.\n\nIn order to make this work, I had to add a field to the struct request,\ninside the flush structure (to store the original req->end_io).  Shaohua\nhad suggested overloading the union with rb_node and completion_data,\nbut the completion data is used by device mapper and can also be used by\nother drivers.  So, I didn't see a way around the additional field.\n\nI tested this patch on an HP EVA with both ext4 and xfs, and it recovers\nthe lost performance.  Comments and other testers, as always, are\nappreciated.\n\nCheers,\nJeff\n\nSigned-off-by: Jeff Moyer <jmoyer@redhat.com>\nAcked-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblk-flush: fix invalid BUG_ON in blk_insert_flush\n\nA user reported a regression due to commit\n4853abaae7e4a2af938115ce9071ef8684fb7af4 (block: fix flush\nmachinery for stacking drivers with differring flush flags).\nPart of the problem is that blk_insert_flush required a\nsingle bio be attached to the request.  In reality, having\nno attached bio is also a valid case, as can be observed with\nan empty flush.\n\n[1] http://www.redhat.com/archives/dm-devel/2011-September/msg00154.html\n\nReported-by: Christophe Saout <christophe@saout.de>\nSigned-off-by: Jeff Moyer <jmoyer@redhat.com\nAcked-by: Tejun Heo <tj@kernel.org>\n\nStable note: 3.1\nCc: stable@vger.kernel.org\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblk-flush: move the queue kick into\n\nA dm-multipath user reported[1] a problem when trying to boot\na kernel with commit 4853abaae7e4a2af938115ce9071ef8684fb7af4\n(block: fix flush machinery for stacking drivers with differring\nflush flags) applied.  It turns out that an empty flush request\ncan be sent into blk_insert_flush.  When the BUG_ON was fixed\nto allow for this, I/O on the underlying device would stall.  The\nreason is that blk_insert_cloned_request does not kick the queue.\nIn the aforementioned commit, I had added a special case to\nkick the queue if data was sent down but the queue flags did\nnot require a flush.  A better solution is to push the queue\nkick up into blk_insert_cloned_request.\n\nThis patch, along with a follow-on which fixes the BUG_ON, fixes\nthe issue reported.\n\n[1] http://www.redhat.com/archives/dm-devel/2011-September/msg00154.html\n\nReported-by: Christophe Saout <christophe@saout.de>\nSigned-off-by: Jeff Moyer <jmoyer@redhat.com>\nAcked-by: Tejun Heo <tj@kernel.org>\n\nStable note: 3.1\nCc: stable@vger.kernel.org\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: warn if tag is greater than real_max_depth.\n\nIn case tag depth is reduced, it is max_depth not real_max_depth.\nSo we should allow a request with tag >= max_depth, but for a\ntag >= real_max_depth, there really should be some problem.\n\nSigned-off-by: Tao Ma <boyu.mt@taobao.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblk-throttle: Free up policy node associated with deleted rule\n\nIf a rule is being deleted, free up associated policy node. Otherwise\nthat memory is leaked.\n\nSigned-off-by: Vivek Goyal <vgoyal@redhat.com>\nAcked-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblk-throttle: Take blkcg->lock while traversing blkcg->policy_list\n\nblkcg->policy_list is protected by blkcg->lock. Its not rcu protected\nlist. So even for readers, they need to take blkcg->lock. There are\nfew functions which were reading the list without taking lock. Fix it.\n\nSigned-off-by: Vivek Goyal <vgoyal@redhat.com>\nAcked-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblk-throttle: use queue_is_locked() instead of lockdep_is_held()\n\nWe can't use the latter if !CONFIG_LOCKDEP.\n\nReported-by: Sedat Dilek <sedat.dilek@googlemail.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: don't call blk_drain_queue() if elevator is not up\n\nblk_cleanup_queue() may be called before elevator is set up on a\nqueue which triggers the following oops.\n\n BUG: unable to handle kernel NULL pointer dereference at           (null)\n IP: [<ffffffff8125a69c>] elv_drain_elevator+0x1c/0x70\n ...\n Pid: 830, comm: kworker/0:2 Not tainted 3.1.0-next-20111025_64+ #1590\n Bochs Bochs\n RIP: 0010:[<ffffffff8125a69c>]  [<ffffffff8125a69c>] elv_drain_elevator+0x1c/0x70\n ...\n Call Trace:\n  [<ffffffff8125da92>] blk_drain_queue+0x42/0x70\n  [<ffffffff8125db90>] blk_cleanup_queue+0xd0/0x1c0\n  [<ffffffff81469640>] md_free+0x50/0x70\n  [<ffffffff8126f43b>] kobject_release+0x8b/0x1d0\n  [<ffffffff81270d56>] kref_put+0x36/0xa0\n  [<ffffffff8126f2b7>] kobject_put+0x27/0x60\n  [<ffffffff814693af>] mddev_delayed_delete+0x2f/0x40\n  [<ffffffff81083450>] process_one_work+0x100/0x3b0\n  [<ffffffff8108527f>] worker_thread+0x15f/0x3a0\n  [<ffffffff81089937>] kthread+0x87/0x90\n  [<ffffffff81621834>] kernel_thread_helper+0x4/0x10\n\nFix it by making blk_cleanup_queue() check whether q->elevator is set\nup before invoking blk_drain_queue.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nReported-and-tested-by: Jiri Slaby <jslaby@suse.cz>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: avoid unnecessary plug list flush\n\nget_request_wait() could sleep and flush the plug list.  If the list is\nalready flushed, don't flush again.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nReviewed-by: Namhyung Kim <namhyung@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: add missed trace_block_plug\n\nAfter flush plug list, the list has no request, so we need to add a\ntrace_block_plug().\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nReviewed-by: Namhyung Kim <namhyung@gmail.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: add blk_queue_dead()\n\nThere are a number of QUEUE_FLAG_DEAD tests.  Add blk_queue_dead()\nmacro and use it.\n\nThis patch doesn't introduce any functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fix drain_all condition in blk_drain_queue()\n\nWhen trying to drain all requests, blk_drain_queue() checked only\nq->rq.count[]; however, this only tracks REQ_ALLOCED requests.  This\npatch updates blk_drain_queue() such that it looks at all the counters\nand queues so that request_queue is actually empty on completion.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: add missing blk_queue_dead() checks\n\nblk_insert_cloned_request(), blk_execute_rq_nowait() and\nblk_flush_plug_list() either didn't check whether the queue was dead\nor did it without holding queue_lock.  Update them so that dead state\nis checked while holding queue_lock.\n\nAFAICS, this plugs all holes (requeue doesn't matter as the request is\ntransitioning atomically from in_flight to queued).\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: move cfqd->cic_index to q->id\n\ncfq allocates per-queue id using ida and uses it to index cic radix\ntree from io_context.  Move it to q->id and allocate on queue init and\nfree on queue release.  This simplifies cfq a bit and will allow for\nfurther improvements of io context life-cycle management.\n\nThis patch doesn't introduce any functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\tinclude/linux/blkdev.h\n\nblock: misc ioc cleanups\n\n* int return from put_io_context() wasn't used by anybody.  Make it\n  return void like other put functions and docbook-fy the function\n  comment.\n\n* Reorder dummy declarations for !CONFIG_BLOCK case a bit.\n\n* Make alloc_ioc_context() use __GFP_ZERO allocation, take init out of\n  if block and drop 0'ing.\n\n* Docbook-fy current_io_context() comment.\n\nThis patch doesn't introduce any functional change.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: rename the return of two functions\n\nIf we rename the return of alloc_io_context() and get_io_context() from\n\"ret\" to \"ioc\" the code get's (a bit) more readable and (a lot) more\ngrepable.\n\nSigned-off-by: Paul Bolle <pebolle@tiscali.nl>\nSigned-off-by: Jens Axboe <jaxboe@fusionio.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: make ioc get/put interface more conventional and fix race on alloction\n\nIgnoring copy_io() during fork, io_context can be allocated from two\nplaces - current_io_context() and set_task_ioprio().  The former is\nalways called from local task while the latter can be called from\ndifferent task.  The synchornization between them are peculiar and\ndubious.\n\n* current_io_context() doesn't grab task_lock() and assumes that if it\n  saw %NULL ->io_context, it would stay that way until allocation and\n  assignment is complete.  It has smp_wmb() between alloc/init and\n  assignment.\n\n* set_task_ioprio() grabs task_lock() for assignment and does\n  smp_read_barrier_depends() between \"ioc = task->io_context\" and \"if\n  (ioc)\".  Unfortunately, this doesn't achieve anything - the latter\n  is not a dependent load of the former.  ie, if ioc itself were being\n  dereferenced \"ioc->xxx\", it would mean something (not sure what tho)\n  but as the code currently stands, the dependent read barrier is\n  noop.\n\nAs only one of the the two test-assignment sequences is task_lock()\nprotected, the task_lock() can't do much about race between the two.\nNothing prevents current_io_context() and set_task_ioprio() allocating\nits own ioc for the same task and overwriting the other's.\n\nAlso, set_task_ioprio() can race with exiting task and create a new\nioc after exit_io_context() is finished.\n\nioc get/put doesn't have any reason to be complex.  The only hot path\nis accessing the existing ioc of %current, which is simple to achieve\ngiven that ->io_context is never destroyed as long as the task is\nalive.  All other paths can happily go through task_lock() like all\nother task sub structures without impacting anything.\n\nThis patch updates ioc get/put so that it becomes more conventional.\n\n* alloc_io_context() is replaced with get_task_io_context().  This is\n  the only interface which can acquire access to ioc of another task.\n  On return, the caller has an explicit reference to the object which\n  should be put using put_io_context() afterwards.\n\n* The functionality of current_io_context() remains the same but when\n  creating a new ioc, it shares the code path with\n  get_task_io_context() and always goes through task_lock().\n\n* get_io_context() now means incrementing ref on an ioc which the\n  caller already has access to (be that an explicit refcnt or implicit\n  %current one).\n\n* PF_EXITING inhibits creation of new io_context and once\n  exit_io_context() is finished, it's guaranteed that both ioc\n  acquisition functions return %NULL.\n\n* All users are updated.  Most are trivial but\n  smp_read_barrier_depends() removal from cfq_get_io_context() needs a\n  bit of explanation.  I suppose the original intention was to ensure\n  ioc->ioprio is visible when set_task_ioprio() allocates new\n  io_context and installs it; however, this wouldn't have worked\n  because set_task_ioprio() doesn't have wmb between init and install.\n  There are other problems with this which will be fixed in another\n  patch.\n\n* While at it, use NUMA_NO_NODE instead of -1 for wildcard node\n  specification.\n\n-v2: Vivek spotted contamination from debug patch.  Removed.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: misc updates to blk_get_queue()\n\n* blk_get_queue() is peculiar in that it returns 0 on success and 1 on\n  failure instead of 0 / -errno or boolean.  Update it such that it\n  returns %true on success and %false on failure.\n\n* Make sure the caller checks for the return value.\n\n* Separate out __blk_get_queue() which doesn't check whether @q is\n  dead and put it in blk.h.  This will be used later.\n\nThis patch doesn't introduce any functional changes.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: misc updates to cfq_io_context\n\nMake the following changes to prepare for ioc/cic management cleanup.\n\n* Add cic->q so that ioc can determine the associated queue without\n  querying cfq.  This will eventually replace ->key.\n\n* Factor out cfq_release_cic() from cic_free_func().  This function\n  assumes that the caller handled locking.\n\n* Rename __cfq_exit_single_io_context() to cfq_exit_cic() and make it\n  take only @cic.\n\n* Restructure cfq_cic_link() for future updates.\n\nThis patch doesn't introduce any functional changes.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\n\tblock/cfq-iosched.c\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: move ioc ioprio/cgroup changed handling to cic\n\nioprio/cgroup change was handled by marking the changed state in ioc\nand, on the following access to the ioc, performing RCU-protected\niteration through all cic's grabbing the matching queue_lock.\n\nThis patch moves the changed state to each cic.  When ioprio or cgroup\nchanges, the respective bit is set on all cic's of the ioc and when\neach of those cic (not ioc) is accessed, change is applied for that\nspecific ioc-queue pair.\n\nThis also fixes the following two race conditions between setting and\nclearing of changed states.\n\n* Missing barrier between assign/load of ioprio and ioprio_changed\n  allowed applying old ioprio.\n\n* Change requests could happen between application of change and\n  clearing of changed variables.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: fix race condition in cic creation path and tighten locking\n\ncfq_get_io_context() would fail if multiple tasks race to insert cic's\nfor the same association.  This patch restructures\ncfq_get_io_context() such that slow path insertion race is handled\nproperly.\n\nNote that the restructuring also makes cfq_get_io_context() called\nunder queue_lock and performs both ioc and cfqd insertions while\nholding both ioc and queue locks.  This is part of on-going locking\ntightening and will be used to simplify synchronization rules.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: fix cic lookup locking\n\n* cfq_cic_lookup() may be called without queue_lock and multiple tasks\n  can execute it simultaneously for the same shared ioc.  Nothing\n  prevents them racing each other and trying to drop the same dead cic\n  entry multiple times.\n\n* smp_wmb() in cfq_exit_cic() doesn't really do anything and nothing\n  prevents cfq_cic_lookup() seeing stale cic->key.  This usually\n  doesn't blow up because by the time cic is exited, all requests have\n  been drained and new requests are terminated before going through\n  elevator.  However, it can still be triggered by plug merge path\n  which doesn't grab queue_lock and thus can't check DEAD state\n  reliably.\n\nThis patch updates lookup locking such that,\n\n* Lookup is always performed under queue_lock.  This doesn't add any\n  more locking.  The only issue is cfq_allow_merge() which can be\n  called from plug merge path without holding any lock.  For now, this\n  is worked around by using cic of the request to merge into, which is\n  guaranteed to have the same ioc.  For longer term, I think it would\n  be best to separate out plug merge method from regular one.\n\n* Spurious ioc->lock locking around cic lookup hint assignment\n  dropped.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: unlink cfq_io_context's immediately\n\ncic is association between io_context and request_queue.  A cic is\nlinked from both ioc and q and should be destroyed when either one\ngoes away.  As ioc and q both have their own locks, locking becomes a\nbit complex - both orders work for removal from one but not from the\nother.\n\nCurrently, cfq tries to circumvent this locking order issue with RCU.\nioc->lock nests inside queue_lock but the radix tree and cic's are\nalso protected by RCU allowing either side to walk their lists without\ngrabbing lock.\n\nThis rather unconventional use of RCU quickly devolves into extremely\nfragile convolution.  e.g. The following is from cfqd going away too\nsoon after ioc and q exits raced.\n\n general protection fault: 0000 [#1] PREEMPT SMP\n CPU 2\n Modules linked in:\n [   88.503444]\n Pid: 599, comm: hexdump Not tainted 3.1.0-rc10-work+ #158 Bochs Bochs\n RIP: 0010:[<ffffffff81397628>]  [<ffffffff81397628>] cfq_exit_single_io_context+0x58/0xf0\n ...\n Call Trace:\n  [<ffffffff81395a4a>] call_for_each_cic+0x5a/0x90\n  [<ffffffff81395ab5>] cfq_exit_io_context+0x15/0x20\n  [<ffffffff81389130>] exit_io_context+0x100/0x140\n  [<ffffffff81098a29>] do_exit+0x579/0x850\n  [<ffffffff81098d5b>] do_group_exit+0x5b/0xd0\n  [<ffffffff81098de7>] sys_exit_group+0x17/0x20\n  [<ffffffff81b02f2b>] system_call_fastpath+0x16/0x1b\n\nThe only real hot path here is cic lookup during request\ninitialization and avoiding extra locking requires very confined use\nof RCU.  This patch makes cic removal from both ioc and request_queue\nperform double-locking and unlink immediately.\n\n* From q side, the change is almost trivial as ioc->lock nests inside\n  queue_lock.  It just needs to grab each ioc->lock as it walks\n  cic_list and unlink it.\n\n* From ioc side, it's a bit more difficult because of inversed lock\n  order.  ioc needs its lock to walk its cic_list but can't grab the\n  matching queue_lock and needs to perform unlock-relock dancing.\n\n  Unlinking is now wholly done from put_io_context() and fast path is\n  optimized by using the queue_lock the caller already holds, which is\n  by far the most common case.  If the ioc accessed multiple devices,\n  it tries with trylock.  In unlikely cases of fast path failure, it\n  falls back to full double-locking dance from workqueue.\n\nDouble-locking isn't the prettiest thing in the world but it's *far*\nsimpler and more understandable than RCU trick without adding any\nmeaningful overhead.\n\nThis still leaves a lot of now unnecessary RCU logics.  Future patches\nwill trim them.\n\n-v2: Vivek pointed out that cic->q was being dereferenced after\n     cic->release() was called.  Updated to use local variable @this_q\n     instead.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nCc: Vivek Goyal <vgoyal@redhat.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: remove delayed unlink\n\nNow that all cic's are immediately unlinked from both ioc and queue,\nlazy dropping from lookup path and trimming on elevator unregister are\nunnecessary.  Kill them and remove now unused elevator_ops->trim().\n\nThis also leaves call_for_each_cic() without any user.  Removed.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: kill ioc_gone\n\nNow that cic's are immediately unlinked under both locks, there's no\nneed to count and drain cic's before module unload.  RCU callback\ncompletion is waited with rcu_barrier().\n\nWhile at it, remove residual RCU operations on cic_list.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: kill cic->key\n\nNow that lazy paths are removed, cfqd_dead_key() is meaningless and\ncic->q can be used whereever cic->key is used.  Kill cic->key.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: replace current_io_context() with create_io_context()\n\nWhen called under queue_lock, current_io_context() triggers lockdep\nwarning if it hits allocation path.  This is because io_context\ninstallation is protected by task_lock which is not IRQ safe, so it\ntriggers irq-unsafe-lock -> irq -> irq-safe-lock -> irq-unsafe-lock\ndeadlock warning.\n\nGiven the restriction, accessor + creator rolled into one doesn't work\ntoo well.  Drop current_io_context() and let the users access\ntask->io_context directly inside queue_lock combined with explicit\ncreation using create_io_context().\n\nFuture ioc updates will further consolidate ioc access and the create\ninterface will be unexported.\n\nWhile at it, relocate ioc internal interface declarations in blk.h and\nadd section comments before and after.\n\nThis patch does not introduce functional change.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nmodified by faux123\n\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: reorder elevator switch sequence\n\nElevator switch sequence first attached the new elevator, then tried\nregistering it (sysfs) and if that failed attached back the old\nelevator.  However, sysfs registration doesn't require the elevator to\nbe attached, so there is no reason to do the \"detach, attach new,\nregister, maybe re-attach old\" sequence.  It can just do \"register,\ndetach, attach\".\n\n* elevator_init_queue() is updated to set ->elevator_data directly and\n  return 0 / -errno.  This allows elevator_exit() on an unattached\n  elevator.\n\n* __elv_unregister_queue() which was necessary to unregister\n  unattached q is removed in favor of __elv_register_queue() which can\n  register unattached q.\n\n* elevator_attach() becomes a single assignment and obscures more then\n  it helps.  Dropped.\n\nThis will help cleaning up io_context handling across elevator switch.\n\nThis patch doesn't introduce visible behavior change.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: remove elevator_queue->ops\n\nelevator_queue->ops points to the same ops struct ->elevator_type.ops\nis pointing to.  The only effect of caching it in elevator_queue is\nshorter notation - it doesn't save any indirect derefence.\n\nRelocate elevator_type->list which used only during module init/exit\nto the end of the structure, rename elevator_queue->elevator_type to\n->type, and replace elevator_queue->ops with elevator_queue->type.ops.\n\nThis doesn't introduce any functional difference.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock, cfq: reorganize cfq_io_context into generic and cfq specific parts\n\nCurrently io_contex…","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/9b08ff91e2d5d82ceb23ee0c9cfc7400f512f3df"},{"sha":"70819a4cbe8f532afa0bcf6d361db23cdb9bc3cd","author":{"email":"bf2f285973d442b26947944421ff270ae9b24e4a@yahoo.com","name":"bsmitty"},"message":" block: Make cfq_target_latency tunable through sysfs.\n\nIn cfq, when we calculate a time slice for a process(or a cfqq to\nbe precise), we have to consider the cfq_target_latency so that all the\nsync request have an estimated latency(300ms) and it is controlled by\ncfq_target_latency. But in some hadoop test, we have found that if\nthere are many processes doing sequential read(24 for example), the\nthroughput is bad because every process can only work for about 25ms\nand the cfqq is switched. That leads to a higher disk seek. We can\nachive the good throughput by setting low_latency=0, but then some\nread's latency is too much for the application.\n\nSo this patch makes cfq_target_latency tunable through sysfs so that\nwe can tune it and find some magic number which is not bad for both\nthe throughput and the read latency.\n\nCc: Jens Axboe <axboe@kernel.dk>\nSigned-off-by: Tao Ma <boyu.mt@taobao.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/70819a4cbe8f532afa0bcf6d361db23cdb9bc3cd"},{"sha":"97943599e1c8b610e3ad5ab2f2441bc813ff849c","author":{"email":"bca9775a3a89282973cc11b345f357144ac2c2b8@gmail.com","name":"Dan Trifan"},"message":"block: add FIOPS i/o scheduler\n\nsquash of the following:\n\nblock: fiops ioscheduler core\n\nFIOPS (Fair IOPS) ioscheduler is IOPS based ioscheduler, so only targets\nfor drive without I/O seek. It's quite similar like CFQ, but the dispatch\ndecision is made according to IOPS instead of slice.\n\nThe algorithm is simple. Drive has a service tree, and each task lives in\nthe tree. The key into the tree is called vios (virtual I/O). Every request\nhas vios, which is calculated according to its ioprio, request size and so\non. Task's vios is the sum of vios of all requests it dispatches. FIOPS\nalways selects task with minimum vios in the service tree and let the task\ndispatch request. The dispatched request's vios is then added to the task's\nvios and the task is repositioned in the sevice tree.\n\nUnlike CFQ, FIOPS doesn't have separate sync/async queues, because with I/O\nless writeback, usually a task can only dispatch either sync or async requests.\nBias read or write request can still be done with read/write scale.\n\nOne issue is if workload iodepth is lower than drive queue_depth, IOPS\nshare of a task might not be strictly according to its priority, request\nsize and so on. In this case, the drive is in idle actually. Solving the\nproblem need make drive idle, so impact performance. I believe CFQ isn't\ncompletely fair between tasks in such case too.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops read/write request scale\n\nread/write speed of Flash based storage usually is different. For example,\nin my SSD maxium thoughput of read is about 3 times faster than that of\nwrite. Add a scale to differenate read and write. Also add a tunable, so\nuser can assign different scale for read and write.\n\nBy default, the scale is 1:1, which means the scale is a noop.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops sync/async scale\n\nCFQ gives 2.5 times more share to sync workload. This matches CFQ.\n\nNote this is different with the read/write scale. We have 3 types of\nrequests:\n1. read\n2. sync write\n3. write\nCFQ doesn't differentitate type 1 and 2, but request cost of 1 and 2\nare usually different for flash based storage. So we have both sync/async\nand read/write scale here.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops add ioprio support\n\nAdd CFQ-like ioprio support. Priority A will get 20% more share than priority\nA+1, which matches CFQ.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops preserve vios key for deep queue depth workload\n\nIf the task has running request, even it's added into service tree newly,\nwe preserve its vios key, so it will not lost its share. This should work\nfor task driving big queue depth. For single depth task, there is no approach\nto preserve its vios key.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops bias sync workload\n\nIf there are async requests running, delay async workload. Otherwise\nasync workload (usually very deep iodepth) will use all queue iodepth\nand later sync requests will get long delayed. The idea is from CFQ.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nblock: fiops add some trace information\n\nAdd some trace information, which is helpful when I do debugging.\n\nSigned-off-by: Shaohua Li <shaohua.li@intel.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\tblock/Kconfig.iosched\n\tblock/Makefile","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/97943599e1c8b610e3ad5ab2f2441bc813ff849c"},{"sha":"9879d7263b236c0c4127e7c3d839e7641cae9c6e","author":{"email":"20b1b82ea87150022f6495522a9f5e355ea8b305@gmail.com","name":"Arianna Avanzini"},"message":"block: cgroups, kconfig, build bits for BFQ-v5-3.3\n\nUpdate Kconfig.iosched to include kernel configuration options\nfor BFQ. Add a Kconfig option and do the related Makefile changes\nto compile the scheduler. Also let the cgroups subsystem know about\nthe BFQ I/O controller.\n\nSigned-off-by: Fabio Checconi <fabio@gandalf.sssup.it>\nSigned-off-by: Paolo Valente <paolo.valente@unimore.it>\nSigned-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>\nSigned-off-by: Dan Trifan <jimsth@gmail.com>\n\nConflicts:\n\tblock/Kconfig.iosched\n\tblock/Makefile\n\tinclude/linux/cgroup_subsys.h","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/9879d7263b236c0c4127e7c3d839e7641cae9c6e"},{"sha":"4efd2eaf386e26e71284c8932b5f8dbfea7ecb2a","author":{"email":"7662eda885d44e77a928581610e3a6d22accb87e@gmail.com","name":"arter97"},"message":"block: introduce the BFQ-v6r2 I/O sched for 3.3","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/4efd2eaf386e26e71284c8932b5f8dbfea7ecb2a"},{"sha":"c98b735d9446e0ebdfb765778bda2090eb114003","author":{"email":"7662eda885d44e77a928581610e3a6d22accb87e@gmail.com","name":"arter97"},"message":"block, bfq: add Early Queue Merge (EQM) to BFQ-v6r2 for 3.3.0","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/c98b735d9446e0ebdfb765778bda2090eb114003"},{"sha":"d2c35b8bb4516bd0bb9c810782fc988857e42604","author":{"email":"7662eda885d44e77a928581610e3a6d22accb87e@gmail.com","name":"arter97"},"message":"block: bfq, blk: fix compilation error","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/d2c35b8bb4516bd0bb9c810782fc988857e42604"},{"sha":"06fe8694faacf86752a86b7a01bb8fe8d5dcbecd","author":{"email":"546b05909706652891a87f7bfe385ae147f61f91@kernel.org","name":"Tejun Heo"},"message":"block: strip out locking optimization in put_io_context()\n\nput_io_context() performed a complex trylock dancing to avoid\ndeferring ioc release to workqueue.  It was also broken on UP because\ntrylock was always assumed to succeed which resulted in unbalanced\npreemption count.\n\nWhile there are ways to fix the UP breakage, even the most\npathological microbench (forced ioc allocation and tight fork/exit\nloop) fails to show any appreciable performance benefit of the\noptimization.  Strip it out.  If there turns out to be workloads which\nare affected by this change, simpler optimization from the discussion\nthread can be applied later.\n\nSigned-off-by: Tejun Heo <tj@kernel.org>\nLKML-Reference: <1328514611.21268.66.camel@sli10-conroe>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\n\nConflicts:\n\tblock/blk-cgroup.c\n\nChange-Id: I67545bea04b754f344e0b5e2f1f7d4dd52aee55d\n\nConflicts:\n\tdrivers/mmc/card/queue.c","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/06fe8694faacf86752a86b7a01bb8fe8d5dcbecd"},{"sha":"25dbebc343906b976ed85549cd77295dcbb1c76c","author":{"email":"209ba179947c35aa8a2a46f4caa398fd10622190@gmail.com","name":"Arne Coucheron"},"message":"block: bfq: Squashed update from v6r2 to v7\n\nConflicts:\n\tblock/bfq-cgroup.c\n\tblock/bfq.h","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/25dbebc343906b976ed85549cd77295dcbb1c76c"},{"sha":"4535b2e9a00b929d94caad170bf5433e43554f14","author":{"email":"bf2f285973d442b26947944421ff270ae9b24e4a@yahoo.com","name":"bsmitty"},"message":"Revert \"block: add ROW i/o scheduler\"\n\nThis reverts commit 1df80891d964925ea0487ff4001ee09740f4ccb7.\n\nConflicts:\n\tblock/Kconfig.iosched\n\tblock/Makefile\n\tblock/row-iosched.c","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/4535b2e9a00b929d94caad170bf5433e43554f14"},{"sha":"fb70b26c89f6467b4258bc3edea844a51db19892","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@xxxxxxxxxxxxxx","name":"Tanya Brokhman"},"message":"block: Adding ROW scheduling algorithm\n\nSigned-off-by: Tatyana Brokhman <tlinder@xxxxxxxxxxxxxx>\n\nConflicts:\n\tblock/Makefile\n\tblock/row-iosched.c","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/fb70b26c89f6467b4258bc3edea844a51db19892"},{"sha":"15e7a98dc29fb0ea7128f1791240aa4f77f02535","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@xxxxxxxxxxxxxx","name":"Tanya Brokhman"},"message":"row: Adding support for reinsert already dispatched req\n\nAdd support for reinserting already dispatched request back to the\nschedulers internal data structures.\nThe request will be reinserted back to the queue (head) it was\ndispatched from as if it was never dispatched.\n\nSigned-off-by: Tatyana Brokhman <tlinder@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/15e7a98dc29fb0ea7128f1791240aa4f77f02535"},{"sha":"f5e8717e9e2ba9fffdfa0ba9e97935242d3ccfa7","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@xxxxxxxxxxxxxx","name":"Tanya Brokhman"},"message":"row: Add support for urgent request handling\n\nThis patch add support for handling urgent requests.\nROW queue can be marked as \"urgent\". If an urgent queue was\nun-served in a previous dispatch cycle and a request was added\nto it - it will trigger issuing urgent request to the device driver.\n\nSigned-off-by: Tatyana Brokhman <tlinder@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/f5e8717e9e2ba9fffdfa0ba9e97935242d3ccfa7"},{"sha":"f04cd0c8eec8c56dbc23108fbfd756bafcc9efcf","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@codeaurora.org","name":"Tatyana Brokhman"},"message":"block: row: Add some debug information on ROW queues\n\n1. Add a counter for number of requests on queue.\n2. Add function to print queues status (number requests\n   currently on queue and number of already dispatched requests\n   in current dispatch cycle).\n\nChange-Id: I1e98b9ca33853e6e6a8ddc53240f6cd6981e6024\nSigned-off-by: Tatyana Brokhman <tlinder@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/f04cd0c8eec8c56dbc23108fbfd756bafcc9efcf"},{"sha":"3ab3ea8b7a21d531f4cfe5cdbdc73e741e5f7565","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@codeaurora.org","name":"Tatyana Brokhman"},"message":"block: row: Insert dispatch_quantum into struct row_queue\n\nThere is really no point in keeping the dispatch quantum\nof a queue outside of it. By inserting it to the row_queue\nstructure we spare extra level in accessing it.\n\nChange-Id: Ic77571818b643e71f9aafbb2ca93d0a92158b199\nSigned-off-by: Tatyana Brokhman <tlinder@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/3ab3ea8b7a21d531f4cfe5cdbdc73e741e5f7565"},{"sha":"e2947f123d23e6444e240c868df2edea416b7faa","author":{"email":"c7fa93ff364b50c0a977a853487528f982a1ac48@codeaurora.org","name":"Tatyana Brokhman"},"message":"block: row: fix sysfs functions - idle_time conversion\n\nidle_time was updated to be stored in msec instead of jiffies.\nSo there is no need to convert the value when reading from user or\ndisplaying the value to him.\n\nChange-Id: I58e074b204e90a90536d32199ac668112966e9cf\nSigned-off-by: Tatyana Brokhman <tlinder@codeaurora.org>","distinct":true,"url":"https://api.github.com/repos/v0idz777/android_kernel_samsung_tuna_omap4/commits/e2947f123d23e6444e240c868df2edea416b7faa"}]}