Page MenuHomeFreeBSD

Significantly speed up ar(1) on UFS file systems
ClosedPublic

Authored by emaste on Jun 28 2015, 2:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 12:51 PM
Unknown Object (File)
Fri, Apr 26, 12:51 PM
Unknown Object (File)
Fri, Apr 26, 7:07 AM
Unknown Object (File)
Feb 3 2024, 1:41 AM
Unknown Object (File)
Dec 28 2023, 9:50 AM
Unknown Object (File)
Dec 23 2023, 6:11 AM
Unknown Object (File)
Dec 23 2023, 6:00 AM
Unknown Object (File)
Nov 11 2023, 4:45 AM

Details

Summary

Fault in the buffer prior to writing as a workaround for poor performance due to interaction with kernel fs deadlock avoidance code. See the comment prior to vn_io_fault_doio() in vfs_vnops.c for details of the issue.

Thanks @kib for diagnosing, providing an explanation of the issue and workaround.

Test Plan
% truncate -s 16M obj.o
% ar r out.a obj.o

Total time with stock and patched ar(1):

x ar.r284891
+ ar.patched
+----------------------------------------------------------------------+   
|+                                                                     |   
|+                                                                    x|   
|+                                                                   xx|   
|A                                                                   |A|   
+----------------------------------------------------------------------+   
    N         Min          Max        Median           Avg        Stddev   
x   3       1.307        1.321         1.315     1.3143333  0.0070237692   
+   3        0.02        0.023         0.022   0.021666667  0.0015275252   
Difference at 95.0% confidence
        -1.29267 +/- 0.0115203
        -98.3515% +/- 0.876513%
        (Student's t, pooled s = 0.00508265)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste retitled this revision from to Significantly speed up ar(1) on UFS file systems.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added a reviewer: kib.
emaste added subscribers: davide, dim, freebsd-toolchain-list, kib.
eadler added a reviewer: eadler.
This revision is now accepted and ready to land.Jun 28 2015, 3:29 PM
usr.bin/ar/write.c
568 ↗(On Diff #6543)

It is simpler to do

if (s == 0)
  return;
for (p = buf; p < buf + s; p += page_size)
   *p;
*(volatile const char *)(buf + s - 1);

I do not insist.

emaste edited edge metadata.
  • give full path to file with comment explaining the deadlock avoidance
  • avoid confusing page mask manipulation and just touch the last byte explicitly
This revision now requires review to proceed.Jun 29 2015, 1:14 PM
kib edited edge metadata.
This revision is now accepted and ready to land.Jun 29 2015, 1:27 PM
This revision was automatically updated to reflect the committed changes.