Whamcloud - gitweb
LU-13799 osc: Improve osc_queue_sync_pages 82/39482/23
authorPatrick Farrell <farr0186@gmail.com>
Tue, 15 Jun 2021 14:23:04 +0000 (10:23 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Jul 2021 21:36:54 +0000 (21:36 +0000)
This patch was split and partially done in:
https://review.whamcloud.com/38214

So the text below refers to the combination of this patch
and that one.  This patch now just improves a looped atomic
add by replacing with a single one.  The rest of the grant
calcuation change is in
https://review.whamcloud.com/38214

(I am retaining the text below to show the performance
improvement)
----------
osc_queue_sync_pages now has a grant calculation component,
this has a pretty painful impact on the new faster DIO
performance.  Specifically, per page ktime_get() and the
per-page atomic_add cost close to 10% of total CPU time in
the DIO path.

We can make this per batch of pages rather than for each
page, which reduces this cost from 10% of CPU to almost
nothing.

This improves write performance by about 10% (but has no
effect on reads, since they don't use grant).

This patch reduces i/o time in ms/GiB by:
Write: 10 ms/GiB
Read: 0 ms/GiB

Totals:
Write: 158 ms/GiB
Read: 161 ms/GiB

mpirun -np 1 $IOR -w -t 1G -b 64G -o $FILE --posix.odirect

Before patch:
write     6071

After patch:
write     6470

(Read is similar.)

This also fixes a mistake in c24c25dc1b / LU-13419 where it
removed the shrink interval update entirely from the direct
i/o path.

Fixes: c24c25dc1b ("LU-13419 osc: Move shrink update to per-write")
Signed-off-by: Patrick Farrell <farr0186@gmail.com>
Change-Id: Ic606e03be58239c291ec0382fa89eba64560da53
Reviewed-on: https://review.whamcloud.com/39482
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_cache.c

index 658e8f4..c33cfae 100644 (file)
@@ -2634,8 +2634,8 @@ int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io,
                        list_for_each_entry(oap, list, oap_pending_item) {
                                osc_consume_write_grant(cli,
                                                        &oap->oap_brw_page);
-                               atomic_long_inc(&obd_dirty_pages);
                        }
+                       atomic_long_add(page_count, &obd_dirty_pages);
                        osc_unreserve_grant_nolock(cli, grants, 0);
                        ext->oe_grants = grants;
                } else {
@@ -2649,6 +2649,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io,
                        "not enough grant available, switching to sync for this i/o\n");
                }
                spin_unlock(&cli->cl_loi_list_lock);
+               osc_update_next_shrink(cli);
        }
 
        ext->oe_is_rdma_only = !!(brw_flags & OBD_BRW_RDMA_ONLY);