Commit 29c877a5 authored by Stephen Champion's avatar Stephen Champion Committed by Greg Kroah-Hartman
Browse files

staging: lustre: misc: Reduce exposure to overflow on page counters.



When the number of an object in use or circulation is tied to memory
size of the system, very large memory systems can overflow 32 bit
counters.  This patch addresses overflow on page counters in the osc LRU
and obd accounting.

Signed-off-by: default avatarStephen Champion <schamp@sgi.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4856
Reviewed-on: http://review.whamcloud.com/10537


Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@gmail.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 f32a6929
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2326,7 +2326,7 @@ struct cl_client_cache {
	/**
	 * # of LRU entries available
	 */
	atomic_t		ccc_lru_left;
	atomic_long_t		ccc_lru_left;
	/**
	 * List of entities(OSCs) for this LRU cache
	 */
@@ -2346,7 +2346,7 @@ struct cl_client_cache {
	/**
	 * # of unstable pages for this mount point
	 */
	atomic_t		ccc_unstable_nr;
	atomic_long_t		ccc_unstable_nr;
	/**
	 * Waitq for awaiting unstable pages to reach zero.
	 * Used at umounting time and signaled on BRW commit
+4 −4
Original line number Diff line number Diff line
@@ -293,13 +293,13 @@ struct client_obd {
	/* lru for osc caching pages */
	struct cl_client_cache	*cl_cache;
	struct list_head	 cl_lru_osc; /* member of cl_cache->ccc_lru */
	atomic_t		*cl_lru_left;
	atomic_t		 cl_lru_busy;
	atomic_long_t		*cl_lru_left;
	atomic_long_t		 cl_lru_busy;
	atomic_long_t		 cl_lru_in_list;
	atomic_t		 cl_lru_shrinkers;
	atomic_t		 cl_lru_in_list;
	struct list_head	 cl_lru_list; /* lru page list */
	spinlock_t		 cl_lru_list_lock; /* page list protector */
	atomic_t		 cl_unstable_count;
	atomic_long_t		 cl_unstable_count;

	/* number of in flight destroy rpcs is limited to max_rpcs_in_flight */
	atomic_t	     cl_destroy_in_flight;
+3 −3
Original line number Diff line number Diff line
@@ -52,9 +52,9 @@ extern unsigned int at_max;
extern unsigned int at_history;
extern int at_early_margin;
extern int at_extra;
extern unsigned int obd_max_dirty_pages;
extern atomic_t obd_dirty_pages;
extern atomic_t obd_dirty_transit_pages;
extern unsigned long obd_max_dirty_pages;
extern atomic_long_t obd_dirty_pages;
extern atomic_long_t obd_dirty_transit_pages;
extern char obd_jobid_var[];

/* Some hash init argument constants */
+3 −3
Original line number Diff line number Diff line
@@ -328,11 +328,11 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
	/* lru for osc. */
	INIT_LIST_HEAD(&cli->cl_lru_osc);
	atomic_set(&cli->cl_lru_shrinkers, 0);
	atomic_set(&cli->cl_lru_busy, 0);
	atomic_set(&cli->cl_lru_in_list, 0);
	atomic_long_set(&cli->cl_lru_busy, 0);
	atomic_long_set(&cli->cl_lru_in_list, 0);
	INIT_LIST_HEAD(&cli->cl_lru_list);
	spin_lock_init(&cli->cl_lru_list_lock);
	atomic_set(&cli->cl_unstable_count, 0);
	atomic_long_set(&cli->cl_unstable_count, 0);

	init_waitqueue_head(&cli->cl_destroy_waitq);
	atomic_set(&cli->cl_destroy_in_flight, 0);
+5 −4
Original line number Diff line number Diff line
@@ -926,7 +926,8 @@ void ll_put_super(struct super_block *sb)
	struct lustre_sb_info *lsi = s2lsi(sb);
	struct ll_sb_info *sbi = ll_s2sbi(sb);
	char *profilenm = get_profile_name(sb);
	int ccc_count, next, force = 1, rc = 0;
	int next, force = 1, rc = 0;
	long ccc_count;

	CDEBUG(D_VFSTRACE, "VFS Op: sb %p - %s\n", sb, profilenm);

@@ -947,13 +948,13 @@ void ll_put_super(struct super_block *sb)
		struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL);

		rc = l_wait_event(sbi->ll_cache->ccc_unstable_waitq,
				  !atomic_read(&sbi->ll_cache->ccc_unstable_nr),
				  !atomic_long_read(&sbi->ll_cache->ccc_unstable_nr),
				  &lwi);
	}

	ccc_count = atomic_read(&sbi->ll_cache->ccc_unstable_nr);
	ccc_count = atomic_long_read(&sbi->ll_cache->ccc_unstable_nr);
	if (!force && rc != -EINTR)
		LASSERTF(!ccc_count, "count: %i\n", ccc_count);
		LASSERTF(!ccc_count, "count: %li\n", ccc_count);

	/* We need to set force before the lov_disconnect in
	 * lustre_common_put_super, since l_d cleans up osc's as well.
Loading