Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17037fbd authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman
Browse files

staging: lustre: osc: Performance tune for LRU



Early launch page LRU work in osc_io_rw_iter_init();
Change the page LRU shrinking policy by OSC attributes;
Delete the contented lock osc_object::oo_seatbelt

Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5108
Reviewed-on: http://review.whamcloud.com/10458


Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aed71a15
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -267,6 +267,14 @@ struct client_obd {
	 * allowed to have multiple threads shrinking LRU cache.
	 * allowed to have multiple threads shrinking LRU cache.
	 */
	 */
	atomic_t		 cl_lru_shrinkers;
	atomic_t		 cl_lru_shrinkers;
	/** The time when this LRU cache was last used. */
	time64_t		 cl_lru_last_used;
	/** stats: how many reclaims have happened for this client_obd.
	 * reclaim and shrink - shrink is async, voluntarily rebalancing;
	 * reclaim is sync, initiated by IO thread when the LRU slots are
	 * in shortage.
	 */
	u64			 cl_lru_reclaim;
	/** List of LRU pages for this client_obd */
	/** List of LRU pages for this client_obd */
	struct list_head	 cl_lru_list;
	struct list_head	 cl_lru_list;
	/** Lock for LRU page list */
	/** Lock for LRU page list */
+4 −2
Original line number Original line Diff line number Diff line
@@ -183,10 +183,12 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v)


	seq_printf(m,
	seq_printf(m,
		   "used_mb: %ld\n"
		   "used_mb: %ld\n"
		   "busy_cnt: %ld\n",
		   "busy_cnt: %ld\n"
		   "reclaim: %llu\n",
		   (atomic_long_read(&cli->cl_lru_in_list) +
		   (atomic_long_read(&cli->cl_lru_in_list) +
		    atomic_long_read(&cli->cl_lru_busy)) >> shift,
		    atomic_long_read(&cli->cl_lru_busy)) >> shift,
		   atomic_long_read(&cli->cl_lru_busy));
		   atomic_long_read(&cli->cl_lru_busy),
		   cli->cl_lru_reclaim);


	return 0;
	return 0;
}
}
+7 −19
Original line number Original line Diff line number Diff line
@@ -1329,7 +1329,6 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
{
{
	struct osc_page *opg = oap2osc_page(oap);
	struct osc_page *opg = oap2osc_page(oap);
	struct cl_page    *page = oap2cl_page(oap);
	struct cl_page    *page = oap2cl_page(oap);
	struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj);
	enum cl_req_type crt;
	enum cl_req_type crt;
	int srvlock;
	int srvlock;


@@ -1344,13 +1343,6 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
	/* Clear opg->ops_transfer_pinned before VM lock is released. */
	/* Clear opg->ops_transfer_pinned before VM lock is released. */
	opg->ops_transfer_pinned = 0;
	opg->ops_transfer_pinned = 0;


	spin_lock(&obj->oo_seatbelt);
	LASSERT(opg->ops_submitter);
	LASSERT(!list_empty(&opg->ops_inflight));
	list_del_init(&opg->ops_inflight);
	opg->ops_submitter = NULL;
	spin_unlock(&obj->oo_seatbelt);

	opg->ops_submit_time = 0;
	opg->ops_submit_time = 0;
	srvlock = oap->oap_brw_flags & OBD_BRW_SRVLOCK;
	srvlock = oap->oap_brw_flags & OBD_BRW_SRVLOCK;


@@ -1381,7 +1373,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,


#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do {			      \
#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do {			      \
	struct client_obd *__tmp = (cli);				      \
	struct client_obd *__tmp = (cli);				      \
	CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu "	      \
	CDEBUG(lvl, "%s: grant { dirty: %lu/%lu dirty_pages: %ld/%lu "	      \
	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d }"	      \
	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d }"	      \
	       "lru {in list: %ld, left: %ld, waiters: %d }" fmt "\n",	      \
	       "lru {in list: %ld, left: %ld, waiters: %d }" fmt "\n",	      \
	       cli_name(__tmp),						      \
	       cli_name(__tmp),						      \
@@ -2246,14 +2238,9 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli,
		return 0;
		return 0;


	if (!async) {
	if (!async) {
		/* disable osc_lru_shrink() temporarily to avoid
		 * potential stack overrun problem. LU-2859
		 */
		atomic_inc(&cli->cl_lru_shrinkers);
		spin_lock(&cli->cl_loi_list_lock);
		spin_lock(&cli->cl_loi_list_lock);
		osc_check_rpcs(env, cli);
		osc_check_rpcs(env, cli);
		spin_unlock(&cli->cl_loi_list_lock);
		spin_unlock(&cli->cl_loi_list_lock);
		atomic_dec(&cli->cl_lru_shrinkers);
	} else {
	} else {
		CDEBUG(D_CACHE, "Queue writeback work for client %p.\n", cli);
		CDEBUG(D_CACHE, "Queue writeback work for client %p.\n", cli);
		LASSERT(cli->cl_writeback_work);
		LASSERT(cli->cl_writeback_work);
@@ -2475,7 +2462,6 @@ int osc_teardown_async_page(const struct lu_env *env,
			    struct osc_object *obj, struct osc_page *ops)
			    struct osc_object *obj, struct osc_page *ops)
{
{
	struct osc_async_page *oap = &ops->ops_oap;
	struct osc_async_page *oap = &ops->ops_oap;
	struct osc_extent *ext = NULL;
	int rc = 0;
	int rc = 0;


	LASSERT(oap->oap_magic == OAP_MAGIC);
	LASSERT(oap->oap_magic == OAP_MAGIC);
@@ -2483,12 +2469,15 @@ int osc_teardown_async_page(const struct lu_env *env,
	CDEBUG(D_INFO, "teardown oap %p page %p at index %lu.\n",
	CDEBUG(D_INFO, "teardown oap %p page %p at index %lu.\n",
	       oap, ops, osc_index(oap2osc(oap)));
	       oap, ops, osc_index(oap2osc(oap)));


	osc_object_lock(obj);
	if (!list_empty(&oap->oap_rpc_item)) {
	if (!list_empty(&oap->oap_rpc_item)) {
		CDEBUG(D_CACHE, "oap %p is not in cache.\n", oap);
		CDEBUG(D_CACHE, "oap %p is not in cache.\n", oap);
		rc = -EBUSY;
		rc = -EBUSY;
	} else if (!list_empty(&oap->oap_pending_item)) {
	} else if (!list_empty(&oap->oap_pending_item)) {
		struct osc_extent *ext = NULL;

		osc_object_lock(obj);
		ext = osc_extent_lookup(obj, osc_index(oap2osc(oap)));
		ext = osc_extent_lookup(obj, osc_index(oap2osc(oap)));
		osc_object_unlock(obj);
		/* only truncated pages are allowed to be taken out.
		/* only truncated pages are allowed to be taken out.
		 * See osc_extent_truncate() and osc_cache_truncate_start()
		 * See osc_extent_truncate() and osc_cache_truncate_start()
		 * for details.
		 * for details.
@@ -2498,10 +2487,9 @@ int osc_teardown_async_page(const struct lu_env *env,
					osc_index(oap2osc(oap)));
					osc_index(oap2osc(oap)));
			rc = -EBUSY;
			rc = -EBUSY;
		}
		}
	}
	osc_object_unlock(obj);
		if (ext)
		if (ext)
			osc_extent_put(env, ext);
			osc_extent_put(env, ext);
	}
	return rc;
	return rc;
}
}


+0 −19
Original line number Original line Diff line number Diff line
@@ -119,16 +119,6 @@ struct osc_object {
	 */
	 */
	int		oo_contended;
	int		oo_contended;
	unsigned long	 oo_contention_time;
	unsigned long	 oo_contention_time;
	/**
	 * List of pages in transfer.
	 */
	struct list_head	 oo_inflight[CRT_NR];
	/**
	 * Lock, protecting osc_page::ops_inflight, because a seat-belt is
	 * locked during take-off and landing.
	 */
	spinlock_t	   oo_seatbelt;

	/**
	/**
	 * used by the osc to keep track of what objects to build into rpcs.
	 * used by the osc to keep track of what objects to build into rpcs.
	 * Protected by client_obd->cli_loi_list_lock.
	 * Protected by client_obd->cli_loi_list_lock.
@@ -356,15 +346,6 @@ struct osc_page {
	 * lru page list. See osc_lru_{del|use}() in osc_page.c for usage.
	 * lru page list. See osc_lru_{del|use}() in osc_page.c for usage.
	 */
	 */
	struct list_head	      ops_lru;
	struct list_head	      ops_lru;
	/**
	 * Linkage into a per-osc_object list of pages in flight. For
	 * debugging.
	 */
	struct list_head	    ops_inflight;
	/**
	 * Thread that submitted this page for transfer. For debugging.
	 */
	struct task_struct	*ops_submitter;
	/**
	/**
	 * Submit time - the time when the page is starting RPC. For debugging.
	 * Submit time - the time when the page is starting RPC. For debugging.
	 */
	 */
+1 −1
Original line number Original line Diff line number Diff line
@@ -133,7 +133,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
		  struct list_head *ext_list, int cmd);
		  struct list_head *ext_list, int cmd);
long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
		    long target, bool force);
		    long target, bool force);
long osc_lru_reclaim(struct client_obd *cli);
long osc_lru_reclaim(struct client_obd *cli, unsigned long npages);


unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock);
unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock);


Loading