All of lore.kernel.org
 help / color / mirror / Atom feed
From: Caz Yokoyama <Caz.Yokoyama@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [igt PATCH v2 1/1] lib: Incrementally mlock()
Date: Tue, 26 Feb 2019 08:06:21 -0800	[thread overview]
Message-ID: <d7eb3a29ff4e25a0cb809dc3be267d1a7860abbb.camel@intel.com> (raw)
In-Reply-To: <53135e5acf3668084a7f8453add2bd04bf2481ed.1550800923.git.caz.yokoyama@intel.com>

As we discussed on the mailng list, please drop my patch.
-caz

On Fri, 2019-02-22 at 02:03 +0000, Caz Yokoyama wrote:
> As we already have the previous portion of the mmap mlocked, we only
> need to mlock() the fresh portion for testing available memory.
> 
> Address calculation on mlock is fixed.
> 
> When the parent process mlocks, i.e.,
>   igt_assert(!mlock(can_mlock, *can_mlock));
> most likely killed.
> 
> In suspend.c, OOM kills when 64MB less memory is mlocked.
> 
> This patch does not make the test faster. It runs 300-900sec.
> I recommend followings.
> 
> 1. Run patched i915_suspend@shrink only on full test(shard test ?)
> 2. add lighter test such as 1) mlock 3/4 of avail memory, 2) suspend-
> resume
> 
> 2 constantly runs less than 5 sec. However, it does not suspend-
> resume
> with exhausting all of system memory.
> 
> Signed-off-by: Caz Yokoyama <caz.yokoyama@intel.com>
> ---
>  lib/intel_os.c       | 17 +++++++++--------
>  tests/i915/suspend.c |  7 +++++--
>  2 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/intel_os.c b/lib/intel_os.c
> index e1e31e23..44e852ee 100644
> --- a/lib/intel_os.c
> +++ b/lib/intel_os.c
> @@ -250,22 +250,23 @@ intel_get_total_pinnable_mem(void)
>  	}
>  
>  	for (uint64_t inc = 1024 << 20; inc >= 4 << 10; inc >>= 2) {
> -		igt_debug("Testing mlock %'"PRIu64" B (%'"PRIu64"
> MiB)\n",
> -			  *can_mlock, *can_mlock >> 20);
> +		uint64_t locked = *can_mlock;
> +
> +		igt_debug("Testing mlock %'"PRIu64"B (%'"PRIu64"MiB) +
> %'"PRIu64"B\n",
> +			  locked, locked >> 20, inc);
>  
>  		igt_fork(child, 1) {
> -			for (uint64_t bytes = *can_mlock;
> -			     bytes <= pin;
> -			     bytes += inc) {
> -				if (mlock(can_mlock, bytes))
> +			uint64_t bytes = *can_mlock;
> +
> +			while (bytes <= pin) {
> +				if (mlock((void *)can_mlock + bytes,
> inc))
>  					break;
>  
> -				*can_mlock = bytes;
> +				*can_mlock = bytes += inc;
>  				__sync_synchronize();
>  			}
>  		}
>  		__igt_waitchildren();
> -		igt_assert(!mlock(can_mlock, *can_mlock));
>  	}
>  
>  out:
> diff --git a/tests/i915/suspend.c b/tests/i915/suspend.c
> index 84cb3b49..99ab68be 100644
> --- a/tests/i915/suspend.c
> +++ b/tests/i915/suspend.c
> @@ -160,6 +160,9 @@ test_sysfs_reader(bool hibernate)
>  	igt_stop_helper(&reader);
>  }
>  
> +#define MB (1 << 20)
> +#define LESS_MEM (252*MB)
> +
>  static void
>  test_shrink(int fd, unsigned int mode)
>  {
> @@ -170,8 +173,8 @@ test_shrink(int fd, unsigned int mode)
>  	intel_purge_vm_caches(fd);
>  
>  	size = intel_get_total_pinnable_mem();
> -	igt_require(size > 64 << 20);
> -	size -= 64 << 20;
> +	igt_require(size > LESS_MEM);
> +	size -= LESS_MEM;
>  
>  	mem = mmap(NULL, size, PROT_READ, MAP_SHARED | MAP_ANON, -1,
> 0);
>  

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2019-02-26 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  2:03 [igt-dev] [igt PATCH v2 1/1] lib: Incrementally mlock() Caz Yokoyama
2019-02-21 20:25 ` Chris Wilson
2019-02-22 16:12 ` Ashutosh Dixit
2019-02-22 17:28   ` Caz Yokoyama
2019-02-26 16:06 ` Caz Yokoyama [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7eb3a29ff4e25a0cb809dc3be267d1a7860abbb.camel@intel.com \
    --to=caz.yokoyama@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.