Bug 196517
Summary: | Statistics of IO using is incorrect | ||
---|---|---|---|
Product: | File System | Reporter: | Sergey Borisov (borisovs) |
Component: | SysFS | Assignee: | Greg Kroah-Hartman (greg) |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | x86-64 | ||
OS: | Linux | ||
Kernel Version: | Linux version 4.8.0-58-generic (buildd@lgw01-21) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | Screenshot |
My ssd can write 250 Mb/sec, but not 5 Gb/sec. On Fri, Jul 28, 2017 at 07:53:47AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=196517 > > Bug ID: 196517 > Summary: Statistics of using IO is incorrect > Product: File System > Version: 2.5 > Kernel Version: Linux version 4.8.0-58-generic (buildd@lgw01-21) (gcc > version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) > ) #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 Please send this to the linux-scsi@vger.kernel.org mailing list if you can reproduce this on a non-distro kernel release (4.8 is very old and obsolete.) On Fri, Jul 28, 2017 at 07:53:47AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=196517 > > Bug ID: 196517 > Summary: Statistics of using IO is incorrect > Product: File System > Version: 2.5 > Kernel Version: Linux version 4.8.0-58-generic (buildd@lgw01-21) (gcc > version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) > ) #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 Please send this to the linux-scsi@vger.kernel.org mailing list if you can reproduce this on a non-distro kernel release (4.8 is very old and obsolete.) On Fri, Jul 28, 2017 at 07:53:47AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=196517 > > Bug ID: 196517 > Summary: Statistics of using IO is incorrect > Product: File System > Version: 2.5 > Kernel Version: Linux version 4.8.0-58-generic (buildd@lgw01-21) (gcc > version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) > ) #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 Please send this to the linux-scsi@vger.kernel.org mailing list if you can reproduce this on a non-distro kernel release (4.8 is very old and obsolete.) I've also reproduced this issue on this kernel Linux desktop 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux And sent email to the linux-scsi@vger.kernel.org mailing list |
Created attachment 257743 [details] Screenshot Each one second, my program reads /sys/block/$DEVICE/stat. It substracts previously saved values, then saves current values, so I know the hdd activity. But sometimes (once in 7 days) I've got too big values for sda (between last and current ones) (5GB/second). sudo lshw -class disk *-disk description: ATA Disk product: SPCC Solid State physical id: 0.0.0 bus info: scsi@2:0.0.0 logical name: /dev/sda version: 08.2 serial: EB84075517B200427436 size: 111GiB (120GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=d01f3b8e Also I've written the script for monitoring the statistics #!/bin/bash while (true) do str=`date`" $(cat /sys/block/sda/stat)" echo $str >> log.txt sleep 10; done And got this values Fr Jul 28 07:39:38 MSK 2017 2368466 475339 105223134 1362848 5753154 7692148 661424840 31319540 0 4790052 32687100 Fr Jul 28 07:39:48 MSK 2017 2368466 475339 105223134 1362848 5753170 7692160 661425104 31319548 0 4790060 32687108 Fr Jul 28 07:39:58 MSK 2017 2368466 475339 105223134 1362848 5753174 7692162 661425152 31319556 0 4790068 32687116 Fr Jul 28 07:40:08 MSK 2017 2369133 475339 105228750 1363380 5771079 7694395 706209560 31324696 0 4795572 32692780 Fr Jul 28 07:40:18 MSK 2017 2369133 475339 105228750 1363380 5771087 7694431 706209960 31324708 0 4795584 32692792 Fr Jul 28 07:40:28 MSK 2017 2369133 475339 105228750 1363380 5771091 7694433 706210008 31324716 0 4795592 32692800 Fr Jul 28 07:40:38 MSK 2017 2369133 475339 105228750 1363380 5771244 7694714 706213528 31325052 0 4795604 32693136 You can see that the difference (3,4 lines) is very big between 706209560 and 661425152, my ssd can read 250 Mb/sec, but not 5 Gb/sec. Also you can use this program for monitoring (g++ -std=c++14 name.cpp) #include <iostream> #include <fstream> #include <regex> #include <tuple> #include <chrono> #include <thread> #include <cstdint> const int HDD_READ_POS = 2; const int HDD_WRITE_POS = 6; const int UNIX_SECTOR_SIZE = 512; uint64_t prevRead = static_cast<uint64_t>(0); uint64_t prevWrite = static_cast<uint64_t>(0); std::tuple<uint64_t, uint64_t> hddStatus(const std::string &name="sda") { std::ifstream in("/sys/block/"+name+"/stat"); auto readVal_ = static_cast<uint64_t>(0); auto writeVal_= static_cast<uint64_t>(0); if ( ! in.is_open() ) { return std::tuple<uint64_t, uint64_t> (readVal_, writeVal_); } std::string line; std::regex rgx ( "\\d+" ); std::regex_token_iterator<std::string::iterator> end; while (std::getline(in, line) ){ std::regex_token_iterator<std::string::iterator> iter( line.begin(), line.end(), rgx, 0 ); int pos_ = 0 ; while ( iter != end ) { if ( pos_ == HDD_READ_POS){ readVal_ = std::stoul( *iter ) ; } if ( pos_ == HDD_WRITE_POS){ writeVal_ = std::stoul( *iter ) ; } ++iter; ++pos_; } } return std::tuple<uint64_t, uint64_t> (readVal_, writeVal_); } void init() { auto values = hddStatus(); prevRead = std::get<0>( values ) * UNIX_SECTOR_SIZE; prevWrite = std::get<1>( values ) * UNIX_SECTOR_SIZE; } int main(int argc, char const *argv[]) { init(); while(true){ std::ofstream stat("statistics.txt", std::fstream::out | std::fstream::app); if ( stat.is_open() ){ auto values = hddStatus(); auto read = std::get<0>( values ) * UNIX_SECTOR_SIZE; auto write = std::get<1>( values ) * UNIX_SECTOR_SIZE; // stat<<"Current Read: "<< read<<" Write: "<<write<<'\n'; if (read > prevRead){ stat<<"Diff Read: "<< read - prevRead <<'\n'; std::cout<<"Diff Read: "<< read - prevRead <<'\n'; } if ( write > prevWrite){ stat<<"Diff Write: "<<write - prevWrite <<'\n'; std::cout<<"Diff Write: "<<write - prevWrite <<'\n'; } prevRead = read; prevWrite = write; std::this_thread::sleep_for(std::chrono::seconds(1)); } } return 0; }