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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6FA4CD4F20 for ; Thu, 5 Sep 2024 04:39:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00D256B00FB; Thu, 5 Sep 2024 00:39:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFE696B03FD; Thu, 5 Sep 2024 00:39:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC6496B0430; Thu, 5 Sep 2024 00:39:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B88226B03FC for ; Thu, 5 Sep 2024 00:39:52 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 403961A01FC for ; Thu, 5 Sep 2024 04:39:52 +0000 (UTC) X-FDA: 82529431824.30.A8A18D6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id B29F114001D for ; Thu, 5 Sep 2024 04:39:49 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725511119; a=rsa-sha256; cv=none; b=fiRQGmtoRio7yezJJKkk4VL6DIBJGqReNh//XqZF801/AF9FzWqvJE0rFmxDuB56nU7RZh zUcZiGCqtNA3xrSOuL/Qy05afmD3MvxfbihA1qmHDFhku6Ij4e4q/45y5kwdDmcdcYqMqt 2dlCsUAThbOZi1Hwz72SJQ7WqIP60A4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725511119; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LrvIJ7YkO0rChSSZ8PWHJZCkjRLrL/AVyDg+xqFIba8=; b=ncjvPgGP2T/QPBd4daAbF0Ko6Jd4MrgyVBn7b6LfhS9ednvM+/2X1imcPWJa0z8+Wqi+q1 Fsxu3f2xiYsN8oC9eRwQ/HVCqbrptk2txpR3W+5IIR4t9VOYyETnvKUAn4H8tJYIKzxmKO u8eaWyC3hHv5gEEiC/T6TUuGr2eKQ+s= Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WzmnC1CVMzpVDr; Thu, 5 Sep 2024 12:37:51 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id EE5DB1400D1; Thu, 5 Sep 2024 12:39:44 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Sep 2024 12:39:44 +0800 Message-ID: Date: Thu, 5 Sep 2024 12:39:43 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Kefeng Wang Subject: Re: [PATCH v2 1/5] mm: compaction: get reference before non LRU movable folio isolation To: Matthew Wilcox CC: Andrew Morton , David Hildenbrand , Baolin Wang , Zi Yan , Vishal Moola , References: <20240829145456.2591719-1-wangkefeng.wang@huawei.com> <20240829145456.2591719-2-wangkefeng.wang@huawei.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Queue-Id: B29F114001D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: sxcyjuc6dir63gxamzguc5ef713qc8w9 X-HE-Tag: 1725511189-498435 X-HE-Meta: U2FsdGVkX18DY1tNBlCXvGkpLAX5Du0q+Yy0PyPzt7/YEM2JH/oYhkXVeEUC4y7T/GZVWiNSm2tVal42KjQKzs2DpN1AOO08/ejR+MletAW+tXMIMSxxBgt2hph2yLw5GA5rBauk/Yi2ZiOzj5yqcd+V8DKn+FCYbS13Bt6yKoUy9o6EYTyFY7Q6P7I2EstRXOaI/CcPJRjInCdCDW0J28QSOitKYzCidoS4NshAhI2TLXHhp6IF9jujVqXrdCozfTw814R9UdTGpWxFUq3+F1pfFjw4Qrag22nUegHE7ZBCdrQgDnEyBqYTSN5rb54MqmsBZGZQzctRmMEjjRDh1o0PQyG570TIQwubm8XXwU2/ru4jAsv5BVhG0BnREOK7OsKMTJKoIVIsyfa7zWtsYCqRKdkV/2soJhqvZVzj2UwGJ/8/JkWUGsQWIJ9hrFKCrPFuSzPAufLDR5mpIcO4YobtLsPWWAX86v+3gjqDt3n615LnUIlqxYdZTNjh6tnJmYGIucVHKl21a4dbIiKkrjcmaF/fIERt2HHNbfhMImpcOwhCU/0Pwp3wXVLx2DNAeIi51ovWlj40pdgMbRqLD8Fy6FJyYW3P0Z+OVP0OhVh+zB0g07X+R3xTKeI60+Y7vmZnrOc/cNoujGYD/wSCAAH/oXz54oixEka4xCkDr0vboo/hGz3h27Az5rHmj4HaEEFOgL09hOqbxDRZ41gJVDuvBGOG0iwVW0lYbIhbQ1JPm4HZJZEC/94VJA/ftPKCNZA57awj8sQWBL6/KX9xTHVpdwy6f+0Pe7rLLGs8s+9Qcxc7TXIwFoOc7EIyYiaMvmp0Tw9Hfql4s+DFaFhf+rjdvzaMYNVJ01cy97P49Bx2V0CuSvsXOJsLNR41KjnHtVqxwRHELaYg/CVnUx8QIdChp2/s3fzZNZzLu30C5P5JaWi4Sk1OZTmYRmq6nh5Bb0DCvMMRiB73GdgKKdY aVFZ42vn nnbXFANvPU9OtOg1dPgPwtVu+E1qPs1RztY7JkAHD2bVgoYd+7sZKx3R+7OQS31tLBu1LSGIrKIoeXdLs5KR+3NqK2sajvBLQlSw/Yb2GuFPYYBTSamhZI+CURIQQ37qCRk2WY8Iu/i/c4pn8uOSrK2jbqg7AaJujqo4Gj2gIuIFg8vyZw+lwCti1i9kdSFm+z4Bv6+NrFAvTqV+08NFme3RmeNXg68FN0Q3z1Zh0T3DqaqpnBZNfgdAg9g== 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: List-Subscribe: List-Unsubscribe: On 2024/9/5 3:02, Matthew Wilcox wrote: > On Mon, Sep 02, 2024 at 06:44:09PM +0800, Kefeng Wang wrote: >> On 2024/8/31 22:04, Matthew Wilcox wrote: >>> On Thu, Aug 29, 2024 at 10:54:52PM +0800, Kefeng Wang wrote: >>>> Non-LRU movable folio isolation will fail if it can't grab a reference >>>> in isolate_movable_page(), so folio_get_nontail_page() could be called >>>> ahead to unify the handling of non-LRU movable/LRU folio isolation a bit, >>>> this is also prepare to convert isolate_movable_page() to take a folio. >>>> Since the reference count of the non-LRU movable folio is increased, >>>> a folio_put() is needed whether the folio is isolated or not. >>> >>> There's a reason I stopped where I did when converting this function >>> to use folios. Usually I would explain, but I think it would do you >>> good to think about why for a bit. >> >> Hm, I don't find the reason, >> >> The major change is that we move folio_get_nontail_page ahead, so we >> may try add a reference for each page, it always fails to isolate >> with/without this changes, so I suppose that there is no issue here, > > You haven't considered the effect on others. Taking the refcount on a > page will necessarily dirty the cacheline. This is compaction code, so > someone else may have this page allocated. The check is done without a > refcount in order to minimise the effect if this page cannot be migrated. > Indeed, I asked whether the taking the refcount on a page unconditionally is accepted or not in v1, but I should wait for more time to see if there are more comments, thanks for your explanation, will consider not only the current code modification, but also other impacts of changes as much as possible. > Try doing this on a NUMA system to really see the effects. > > More broadly, the problem is that you're sending patches faster than I > can review them, and Andrew is picking them up. I don't know what to > do about that. OK, I will slowdown for the new version to collect more comments.