lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 11 Nov 2009 16:56:28 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Hugh Dickins <hugh.dickins@...cali.co.uk>
Cc:	kosaki.motohiro@...fujitsu.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	Izik Eidus <ieidus@...hat.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Nick Piggin <npiggin@...e.de>, Rik van Riel <riel@...hat.com>,
	Lee Schermerhorn <Lee.Schermerhorn@...com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 2/6] mm: mlocking in try_to_unmap_one

Hi Hugh

> @@ -1081,45 +1053,23 @@ static int try_to_unmap_file(struct page
>  	unsigned long max_nl_cursor = 0;
>  	unsigned long max_nl_size = 0;
>  	unsigned int mapcount;
> -	unsigned int mlocked = 0;
> -	int unlock = TTU_ACTION(flags) == TTU_MUNLOCK;
> -
> -	if (MLOCK_PAGES && unlikely(unlock))
> -		ret = SWAP_SUCCESS;	/* default for try_to_munlock() */
>  
>  	spin_lock(&mapping->i_mmap_lock);
>  	vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
> -		if (MLOCK_PAGES && unlikely(unlock)) {
> -			if (!((vma->vm_flags & VM_LOCKED) &&
> -						page_mapped_in_vma(page, vma)))
> -				continue;	/* must visit all vmas */
> -			ret = SWAP_MLOCK;
> -		} else {
> -			ret = try_to_unmap_one(page, vma, flags);
> -			if (ret == SWAP_FAIL || !page_mapped(page))
> -				goto out;
> -		}
> -		if (ret == SWAP_MLOCK) {
> -			mlocked = try_to_mlock_page(page, vma);
> -			if (mlocked)
> -				break;  /* stop if actually mlocked page */
> -		}
> +		ret = try_to_unmap_one(page, vma, flags);
> +		if (ret != SWAP_AGAIN || !page_mapped(page))
> +			goto out;
>  	}
>  
> -	if (mlocked)
> +	if (list_empty(&mapping->i_mmap_nonlinear))
>  		goto out;
>
> -	if (list_empty(&mapping->i_mmap_nonlinear))
> +	/* We don't bother to try to find the munlocked page in nonlinears */
> +	if (MLOCK_PAGES && TTU_ACTION(flags) == TTU_MUNLOCK)
>  		goto out;

I have dumb question.
Does this shortcut exiting code makes any behavior change?




>  
>  	list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
>  						shared.vm_set.list) {
> -		if (MLOCK_PAGES && unlikely(unlock)) {
> -			if (!(vma->vm_flags & VM_LOCKED))
> -				continue;	/* must visit all vmas */
> -			ret = SWAP_MLOCK;	/* leave mlocked == 0 */
> -			goto out;		/* no need to look further */
> -		}
>  		if (!MLOCK_PAGES && !(flags & TTU_IGNORE_MLOCK) &&
>  			(vma->vm_flags & VM_LOCKED))
>  			continue;
> @@ -1161,10 +1111,9 @@ static int try_to_unmap_file(struct page
>  			cursor = (unsigned long) vma->vm_private_data;
>  			while ( cursor < max_nl_cursor &&
>  				cursor < vma->vm_end - vma->vm_start) {
> -				ret = try_to_unmap_cluster(cursor, &mapcount,
> -								vma, page);
> -				if (ret == SWAP_MLOCK)
> -					mlocked = 2;	/* to return below */
> +				if (try_to_unmap_cluster(cursor, &mapcount,
> +						vma, page) == SWAP_MLOCK)
> +					ret = SWAP_MLOCK;
>  				cursor += CLUSTER_SIZE;
>  				vma->vm_private_data = (void *) cursor;
>  				if ((int)mapcount <= 0)
> @@ -1185,10 +1134,6 @@ static int try_to_unmap_file(struct page
>  		vma->vm_private_data = NULL;
>  out:
>  	spin_unlock(&mapping->i_mmap_lock);
> -	if (mlocked)
> -		ret = SWAP_MLOCK;	/* actually mlocked the page */
> -	else if (ret == SWAP_MLOCK)
> -		ret = SWAP_AGAIN;	/* saw VM_LOCKED vma */
>  	return ret;
>  }
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists