From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A65DEC4361B for ; Sat, 19 Dec 2020 03:18:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2931C23BB5 for ; Sat, 19 Dec 2020 03:18:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2931C23BB5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E75F6B005C; Fri, 18 Dec 2020 22:18:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 298766B005D; Fri, 18 Dec 2020 22:18:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 187556B0068; Fri, 18 Dec 2020 22:18:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id F40FB6B005C for ; Fri, 18 Dec 2020 22:18:55 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A87568249980 for ; Sat, 19 Dec 2020 03:18:55 +0000 (UTC) X-FDA: 77608575030.22.bee06_141390927442 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 8BC6E180C44AE for ; Sat, 19 Dec 2020 03:18:55 +0000 (UTC) X-HE-Tag: bee06_141390927442 X-Filterd-Recvd-Size: 4630 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Sat, 19 Dec 2020 03:18:54 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BJ3GT2a004791; Sat, 19 Dec 2020 03:18:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=v6q6IbegRXRbGCELj5Zvab6ivdH8CTWiLtARp7czLwE=; b=p1KdMGHt6c12R61yXtFiDyB+J6kaBzzMB1jPHJQfq4pfJ9NXbnF9RtzXAaX8UnbzINDV 1nSaYjgw//u8xepQXXw46DNm/9s7GK8ly+eniTuQQZCu39yv3b+vAukXKDuFtBSxqztt BMTLGwNQLfZnL+MFZ9R+GLbKNfEHb1SIaY0z2obzOF0Ii81wlT/AsjnxMuzTfGYMaS2V VvQeCU1UXKlauy75ok6GKJnDP6wlRlZUzil/Y3PhvuTvXFmjY7tG7EvGGWI4C0xunQ55 qcdQAS3HR+ZVKdQI6ZGlFyIvh5d0c06ts0XZZRXrFCiNmYhj7mhUmgqtJY254hPCnKEH NQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 35h8xqr1c6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 19 Dec 2020 03:18:52 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BJ3GL6r178625; Sat, 19 Dec 2020 03:18:51 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 35h6mrkvqn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 Dec 2020 03:18:51 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0BJ3InUJ022223; Sat, 19 Dec 2020 03:18:50 GMT Received: from [10.191.10.149] (/10.191.10.149) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 Dec 2020 19:18:49 -0800 Subject: Re: [PATCH] mm/vmscan: DRY cleanup for do_try_to_free_pages() To: Chris Down Cc: Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org References: <20201218102217.186836-1-jian.w.wen@oracle.com> <20201218105153.GX32193@dhcp22.suse.cz> <20201218142717.GA32193@dhcp22.suse.cz> <63e8a821-a3f6-47a6-f438-b27c32f4a05f@oracle.com> From: Jacob Wen Message-ID: Date: Sat, 19 Dec 2020 11:18:43 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9839 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=866 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012190019 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9839 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 clxscore=1011 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=878 suspectscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012190019 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/19/20 9:21 AM, Chris Down wrote: > Jacob Wen writes: >> set_task_reclaim_state() is a function with 3 lines of code of which >> 2 lines contain WARN_ON_ONCE. >> >> I am not comfortable with the current repetition. > > Ok, but could you please go into _why_ others should feel that way > too? There are equally also reasons to err on the side of leaving code > as-is -- since we know it already works, and this code generally has > pretty high inertia -- and avoid mutation of code without concrete > description of the benefits. I don't get your point. The patch doesn't change code of set_task_reclaim_state(), so I am fine with the repeated WARN_ON_ONCE. I mean I prefer removing duplicate code to avoid going down the rabbit hole of set_task_reclaim_state(). It's a fundamental principle to me to move the code into its own function. I'd like to hear the others' opinions.