Re: [PATCH i-g-t] lib: Do two writes to /proc/sys/vm/drop_caches again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 27, 2016 at 10:45:17AM +0300, Petri Latvala wrote:
> The drop_caches sysctl has a max value of 4, so writing 7 to it just
> fails. Avoid the earlier two-writes problem by seeking to the
> beginning between writes.
> 
> Signed-off-by: Petri Latvala <petri.latvala@xxxxxxxxx>
> ---
>  lib/intel_os.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/intel_os.c b/lib/intel_os.c
> index b9f970d..cb3b062 100644
> --- a/lib/intel_os.c
> +++ b/lib/intel_os.c
> @@ -299,11 +299,16 @@ void intel_purge_vm_caches(void)
>  	if (fd < 0)
>  		return;
>  
> +	/* BIT(2): Be quiet. Cannot be combined with other operations,
> +	 * the sysctl has a max value of 4.
> +	 */
> +	igt_ignore_warn(write(fd, "4\n", 2));
> +	igt_assert(lseek(fd, 0, SEEK_SET) == 0);

Don't assert here. If you think it might fail, just close and reopen.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux