Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbdCCQLw (ORCPT ); Fri, 3 Mar 2017 11:11:52 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51988 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752331AbdCCQLu (ORCPT ); Fri, 3 Mar 2017 11:11:50 -0500 Subject: Re: [RFC 07/11] mm: remove SWAP_AGAIN in ttu To: Minchan Kim , Andrew Morton References: <1488436765-32350-1-git-send-email-minchan@kernel.org> <1488436765-32350-8-git-send-email-minchan@kernel.org> Cc: kernel-team@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko From: Anshuman Khandual Date: Fri, 3 Mar 2017 18:24:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1488436765-32350-8-git-send-email-minchan@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030312-0032-0000-0000-000001F35CC9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030312-0033-0000-0000-00001225CFC1 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-03_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703030123 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1911 Lines: 62 On 03/02/2017 12:09 PM, Minchan Kim wrote: > In 2002, [1] introduced SWAP_AGAIN. > At that time, ttuo used spin_trylock(&mm->page_table_lock) so it's Small nit: Please expand "ttuo" here. TTU in the first place is also not very clear but we have that in many places. > really easy to contend and fail to hold a lock so SWAP_AGAIN to keep > LRU status makes sense. Okay. > > However, now we changed it to mutex-based lock and be able to block > without skip pte so there is a few of small window to return > SWAP_AGAIN so remove SWAP_AGAIN and just return SWAP_FAIL. Makes sense. > > [1] c48c43e, minimal rmap > Signed-off-by: Minchan Kim > --- > mm/rmap.c | 11 +++-------- > mm/vmscan.c | 2 -- > 2 files changed, 3 insertions(+), 10 deletions(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index 47898a1..da18f21 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1492,13 +1492,10 @@ static int page_mapcount_is_zero(struct page *page) > * Return values are: > * > * SWAP_SUCCESS - we succeeded in removing all mappings > - * SWAP_AGAIN - we missed a mapping, try again later > * SWAP_FAIL - the page is unswappable > */ > int try_to_unmap(struct page *page, enum ttu_flags flags) > { > - int ret; > - > struct rmap_walk_control rwc = { > .rmap_one = try_to_unmap_one, > .arg = (void *)flags, > @@ -1518,13 +1515,11 @@ int try_to_unmap(struct page *page, enum ttu_flags flags) > rwc.invalid_vma = invalid_migration_vma; > > if (flags & TTU_RMAP_LOCKED) > - ret = rmap_walk_locked(page, &rwc); > + rmap_walk_locked(page, &rwc); > else > - ret = rmap_walk(page, &rwc); > + rmap_walk(page, &rwc); > > - if (!page_mapcount(page)) > - ret = SWAP_SUCCESS; > - return ret; > + return !page_mapcount(page) ? SWAP_SUCCESS: SWAP_FAIL; Its very simple now. So after the rmap_walk() if page is not mapped any more return SWAP_SUCCESS otherwise SWAP_FAIL.