svn commit: r327354 - head/sys/vm

Eric van Gyzen eric at vangyzen.net
Thu Jan 18 20:02:12 UTC 2018


On 01/17/2018 16:40, Gleb Smirnoff wrote:
> On Fri, Dec 29, 2017 at 07:05:07PM +0000, Konstantin Belousov wrote:
> K> Author: kib
> K> Date: Fri Dec 29 19:05:07 2017
> K> New Revision: 327354
> K> URL: https://svnweb.freebsd.org/changeset/base/327354
> K> 
> K> Log:
> K>   Style.
> K>   
> K>   Reviewed by:	alc
> K>   Sponsored by:	The FreeBSD Foundation
> K>   MFC after:	1 week
> K>   Differential revision:	https://reviews.freebsd.org/D13678
> K> 
> K> Modified:
> K>   head/sys/vm/vm_swapout.c
> K> 
> K> Modified: head/sys/vm/vm_swapout.c
> K> ==============================================================================
> K> --- head/sys/vm/vm_swapout.c	Fri Dec 29 18:42:55 2017	(r327353)
> K> +++ head/sys/vm/vm_swapout.c	Fri Dec 29 19:05:07 2017	(r327354)
> K> @@ -556,16 +556,14 @@ vm_thread_swapin(struct thread *td)
> K>  {
> K>  	vm_object_t ksobj;
> K>  	vm_page_t ma[KSTACK_MAX_PAGES];
> K> -	int pages;
> K> +	int a, count, i, j, pages, rv;
> K>  
> K>  	pages = td->td_kstack_pages;
> K>  	ksobj = td->td_kstack_obj;
> K>  	VM_OBJECT_WLOCK(ksobj);
> K>  	(void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma,
> K>  	    pages);
> K> -	for (int i = 0; i < pages;) {
> K> -		int j, a, count, rv;
> K> -
> K> +	for (i = 0; i < pages;) {
> K>  		vm_page_assert_xbusied(ma[i]);
> K>  		if (ma[i]->valid == VM_PAGE_BITS_ALL) {
> K>  			vm_page_xunbusy(ma[i]);
> 
> Yeah, style is sacred, but is there a single person on Earth who would
> not agree that moving variables from smaller blocks to function block
> reduces readability of the code?

I agree that it reduces the readability.  Not only that, it also
encourages real bugs by allowing access to the variable when it does not
make sense.

Eric


More information about the svn-src-all mailing list