From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753993AbdJSO6S (ORCPT ); Thu, 19 Oct 2017 10:58:18 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35296 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753912AbdJSO6Q (ORCPT ); Thu, 19 Oct 2017 10:58:16 -0400 From: Anshuman Khandual To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, shli@kernel.org Subject: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page() Date: Thu, 19 Oct 2017 20:26:57 +0530 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17101914-0016-0000-0000-000004F76FDB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101914-0017-0000-0000-00002832CA3D Message-Id: <20171019145657.11199-1-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-19_05:,, 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-1707230000 definitions=main-1710190205 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Its already assumed that the PageActive flag is clear on the input page, hence page_lru(page) will pick the base LRU for the page. In the same way page_lru(page) will pick active base LRU, once the flag PageActive is set on the page. This change of LRU list should happen implicitly through the page flags instead of being hard coded. Signed-off-by: Anshuman Khandual --- mm/swap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index fcd82bc..494276b 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, { if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) { int file = page_is_file_cache(page); - int lru = page_lru_base_type(page); - del_page_from_lru_list(page, lruvec, lru); + del_page_from_lru_list(page, lruvec, page_lru(page)); SetPageActive(page); - lru += LRU_ACTIVE; - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec, page_lru(page)); trace_mm_lru_activate(page); __count_vm_event(PGACTIVATE); -- 1.8.5.2