Re: [PATCH] mm: shmem: unlock valid page

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

 



On Sun, 4 Mar 2012, Hillf Danton wrote:
> In shmem_read_mapping_page_gfp() page is unlocked if no error returned,
> so the unlocked page has to valid.
> 
> To guarantee that validity, when getting page, success result is feed
> back to caller only when page is valid.
> 
> Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>

I don't understand your description, nor its relation to the patch.

NAK to the patch: when no page has previously been allocated, the
SGP_READ case avoids allocation and returns NULL - do_shmem_file_read
then copies the ZERO_PAGE instead, avoiding lots of unnecessary memory
allocation when reading a large sparse file.

Hugh

> ---
> 
> --- a/mm/shmem.c	Sun Mar  4 12:17:42 2012
> +++ b/mm/shmem.c	Sun Mar  4 12:26:56 2012
> @@ -889,13 +889,13 @@ repeat:
>  		goto failed;
>  	}
> 
> -	if (page || (sgp == SGP_READ && !swap.val)) {
> +	if (page) {
>  		/*
>  		 * Once we can get the page lock, it must be uptodate:
>  		 * if there were an error in reading back from swap,
>  		 * the page would not be inserted into the filecache.
>  		 */
> -		BUG_ON(page && !PageUptodate(page));
> +		BUG_ON(!PageUptodate(page));
>  		*pagep = page;
>  		return 0;
>  	}
> --
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]