Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569AbZKKLgP (ORCPT ); Wed, 11 Nov 2009 06:36:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753072AbZKKLgO (ORCPT ); Wed, 11 Nov 2009 06:36:14 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:10697 "EHLO mk-filter-2-a-1.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbZKKLgO (ORCPT ); Wed, 11 Nov 2009 06:36:14 -0500 X-Trace: 287707938/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/80.41.12.20/None/hugh.dickins@tiscali.co.uk X-SBRS: None X-RemoteIP: 80.41.12.20 X-IP-MAIL-FROM: hugh.dickins@tiscali.co.uk X-SMTP-AUTH: X-MUA: X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvQAAKow+kpQKQwU/2dsb2JhbAAI3BmCOYIDBA X-IronPort-AV: E=Sophos;i="4.44,722,1249254000"; d="scan'208";a="287707938" Date: Wed, 11 Nov 2009 11:36:15 +0000 (GMT) From: Hugh Dickins X-X-Sender: hugh@sister.anvils To: KOSAKI Motohiro cc: Andrew Morton , Izik Eidus , Andrea Arcangeli , Nick Piggin , Rik van Riel , Lee Schermerhorn , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/6] mm: mlocking in try_to_unmap_one In-Reply-To: <20091111102400.FD36.A69D9226@jp.fujitsu.com> Message-ID: References: <20091111102400.FD36.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2614 Lines: 61 On Wed, 11 Nov 2009, KOSAKI Motohiro wrote: Though it doesn't quite answer your question, I'll just reinsert the last paragraph of my description here... > > try_to_unmap_file()'s TTU_MUNLOCK nonlinear handling was particularly > > amusing: once unravelled, it turns out to have been choosing between > > two different ways of doing the same nothing. Ah, no, one way was > > actually returning SWAP_FAIL when it meant to return SWAP_SUCCESS. ... > > @@ -1081,45 +1053,23 @@ static int try_to_unmap_file(struct page ... > > > > - 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? Not dumb. My intention was to make no behaviour change with any of this patch; but in checking back before completing the description, I suddenly realized that that shortcut intentionally avoids the if (max_nl_size == 0) { /* all nonlinears locked or reserved ? */ ret = SWAP_FAIL; goto out; } (which doesn't show up in the patch: you'll have to look at rmap.c), which used to have the effect of try_to_munlock() returning SWAP_FAIL in the case when there were one or more VM_NONLINEAR vmas of the file, but none of them (and none of the covering linear vmas) VM_LOCKED. That should have been a SWAP_SUCCESS case, or with my changes another SWAP_AGAIN, either of which would make munlock_vma_page() count_vm_event(UNEVICTABLE_PGMUNLOCKED); which would be correct; but the SWAP_FAIL meant that count was not incremented in this case. Actually, I've double-fixed that, because I also changed munlock_vma_page() to increment the count whenever ret != SWAP_MLOCK; which seemed more appropriate, but would have been a no-op if try_to_munlock() only returned SWAP_SUCCESS or SWAP_AGAIN or SWAP_MLOCK as it claimed. But I wasn't very inclined to boast of fixing that bug, since my testing didn't give confidence that those /proc/vmstat unevictable_pgs_*lock* counts are being properly maintained anyway - when I locked the same pages in two vmas then unlocked them in both, I ended up with mlocked bigger than munlocked (with or without my 2/6 patch); which I suspect is wrong, but rather off my present course towards KSM swapping... Hugh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/