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
F103140067: D2933.id6545.diff
Thu, Nov 21, 1:08 PM
Unknown Object (File)
Fri, Nov 8, 8:11 AM
Unknown Object (File)
Fri, Nov 8, 5:56 AM
Unknown Object (File)
Tue, Nov 5, 8:11 AM
Unknown Object (File)
Oct 18 2024, 8:56 AM
Unknown Object (File)
Oct 16 2024, 1:52 PM
Unknown Object (File)
Oct 16 2024, 3:39 AM
Unknown Object (File)
Oct 15 2024, 7:51 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 #6524)

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.