From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751068AbdJ0EGv (ORCPT ); Fri, 27 Oct 2017 00:06:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54494 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbdJ0EGr (ORCPT ); Fri, 27 Oct 2017 00:06:47 -0400 Subject: Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page() To: Anshuman Khandual , Michal Hocko References: <20171019145657.11199-1-khandual@linux.vnet.ibm.com> <20171019153322.c4uqalws7l7fdzcx@dhcp22.suse.cz> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, shli@kernel.org From: Anshuman Khandual Date: Fri, 27 Oct 2017 09:36:37 +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: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17102704-0040-0000-0000-000004077010 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102704-0041-0000-0000-000020A9E710 Message-Id: <2fc28494-d0d2-9b65-aeb7-1ccabf210917@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-27_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710270052 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/23/2017 08:52 AM, Anshuman Khandual wrote: > On 10/19/2017 09:03 PM, Michal Hocko wrote: >> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote: >>> 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. >> >> The patch description tells what but it doesn't explain _why_? Does the >> resulting code is better, more optimized or is this a pure readability >> thing? > > Not really. Not only it removes couple of lines of code but it also > makes it look more logical from function flow point of view as well. > >> >> All I can see is that page_lru is more complex and a large part of it >> can be optimized away which has been done manually here. I suspect the >> compiler can deduce the same thing. > > Why not ? I mean, that is the essence of the function page_lru() which > should get us the exact LRU list the page should be on and hence we > should not hand craft these manually. Hi Michal, Did not hear from you on this. So wondering what is the verdict about this patch ? - Anshuman