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 AFEE2CD4F23 for ; Wed, 4 Sep 2024 19:02:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C8496B03B6; Wed, 4 Sep 2024 15:02:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 379166B03B7; Wed, 4 Sep 2024 15:02:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 219D26B03B8; Wed, 4 Sep 2024 15:02:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F36D56B03B6 for ; Wed, 4 Sep 2024 15:02:57 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 603441617C3 for ; Wed, 4 Sep 2024 19:02:57 +0000 (UTC) X-FDA: 82527977994.02.8A1E9DD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 2A0BCA0002 for ; Wed, 4 Sep 2024 19:02:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b8kwxx2q; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725476527; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=g6LCnZjR6mRvbn6pH0tLTKLz4dWSjvPQVxrotJGat3w=; b=7+iEzak3M59pRhZd6BcotiARgGv8jMDLk8UI9tGYAuxtTH59OBF59ZjVUmYU5sdtQm1dLZ ZGEEA/mjRNqaggcPWNzuFj86Zixh4fwdH3NHWuZCpp//McLMH11TN2F49pD69rOqBhE9KJ hRy/Bisd4af6K4kUdVZGAlx1+ZxQ+iU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b8kwxx2q; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725476527; a=rsa-sha256; cv=none; b=s1yuI2NS2BgAx4OZSGPu8Kz1e7kNYamLFm++4dMI47aUcP0CruQhBB5x6weOGpq3IhccUe oIuSiXJkS00wXhmwoYdPFxygveMwkIGR9Kkpn6JSbaY0+fOfnY5ESLnnZ4xMaExlsh3fBg +/Vx3Wq2xrEyWFyAGv1C6r6jhnwXVXE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=g6LCnZjR6mRvbn6pH0tLTKLz4dWSjvPQVxrotJGat3w=; b=b8kwxx2qucpI/Z6svvrnK3Ho9W 7s3kYz8UcHgWAHJBvxK+AQnsu377ihuvVUVBDX2GArSy7ephWcVKeMIvQNnmVll+eMS0ZUiBg8Qyi +Z+gJNXMWH1QSzY7nCTZIutb5NKNd3DCTPwc0hZj4bfWi94bFziSz2Zlg9axXHwdY7ROIca8GgA8h iuw1bMNraS4fg7OPKf9Ni8JpALMWP8IKgHvjiB+p3gaamshszpoeEIyDoA9lkdawgLH5g3UBvv2T9 ev6McWFiPP4ljinRRLxH5c7ozPrs3gRF9ARm3y1W+iZp4+R2YmicQSE29SXnNnj/2loKXTr8RG1qn xN6YE91w==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1slvHA-00000001Hhz-23HQ; Wed, 04 Sep 2024 19:02:44 +0000 Date: Wed, 4 Sep 2024 20:02:44 +0100 From: Matthew Wilcox To: Kefeng Wang Cc: Andrew Morton , David Hildenbrand , Baolin Wang , Zi Yan , Vishal Moola , linux-mm@kvack.org Subject: Re: [PATCH v2 1/5] mm: compaction: get reference before non LRU movable folio isolation Message-ID: References: <20240829145456.2591719-1-wangkefeng.wang@huawei.com> <20240829145456.2591719-2-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 2A0BCA0002 X-Stat-Signature: reh97utn8za3ewyzi15dx9mu6rdeu3n6 X-HE-Tag: 1725476573-329061 X-HE-Meta: U2FsdGVkX1/neGXQtfgSvvTSnwq3F95O3Iu3zjD3cDPDnWdZWjDA+kmVBKGz8OXxLNdM/8j4IzxVCpFa/ROS2DaRgsvggFXHy7ZVxdgjxIW5hWurkFF2IKqTKxTGRY6Sh7/Ad5FOjR47r6aXSGFGDWNXB8jT24sLp7uReunJkGoqLtrlAN/SSIU7/ufpBJOyRzmH+csWJRQBpdzN3BKtX1JoGK9GWKcEvLxKuZlGpSavG+xs/9znTrlY8+y1Wl64ns0mbBzCenmS5I5r5ttVk5coFLV9fHNRrQthcx1k7jt3WUx+8rtpP0ealMWzb9+10cSc5OTqRDbf3CT5vihnoyIQzHPMdmnpXtQGWohzcKC6GCby8qXpbCurDKsjZgU1t70R6DwcnZeG/NP8i3z7gCQeNXA5RKt4Ap555NtORgfI5NRRMmVEXGYBu8COaOLV8/2J7GvWWuqoEXLT9ctmoJRoimd/kUEdMAaediveQBXW4Nc0GRo1sTZoZaaj6bfdiQ2wqy/tWMQRw5qTJ4PGkvqht6JLZjTUG8Dx7Fq1Ki2eFN/3Oe0XAitnBrDuSr4BM9Bl43BD1kDXAvHI7mXRY87ccZ6p31UzjbTZEuyuxq6nieE5ibVVX653IcGYpgbWa3T3zzFGSrA7t7hASUuqWiuciSL2213oBekEyB4e5pyQk4ufRAzmhDaRaM/TkIetVoQxZ0K9YHheBGiXcMoIwz0d7Xu6A6aFOkhvmFXDt6bI0uIDOAzzCfnu6J2pMb87JUk6O1KPpnAfpufg5VC68oAu1et93t9rKBm6EqzBjL1BxJz0eKA8ZnMr143zZtFwR+H6cVkoCiEOpll/4mHbOQy8IHx40Pi+6gpQbYrqqzclfV/xwxtfSKTA1/1+TBMenVL1i3Y4zl+GwBHJUY0BFmyoEUMzTg7fcHZzY8AhcXbw2VVTMs87Br7IJd01ACpxu4Y5YdhHOs+7w3rE1uY ONcKBUOU DIuF5nZ3ZJLdrHt8c8+/PkDs8ZXDoLntBQzgHH9yknKTrwy+ITkvBsdnNgM84yfUTz+PtmSQAnGzzZr/Y0hWfjw3QM/qwdDnkhBJYpdRkRyP6ACN3r7hOcjs37DnCaz8v6UiAEp4KR0W+VG/0eTLjHP0jFHnRwNLR9Fc89Nlx3nw2H82jXl8jmlT3BTK0AtqiQtG0Y84sjfBSm4TSxCS6/mOhKtJjQYIk81YbOwuJBE1qkJ0KedRxjC3Uqghqo67V/Y8ouns1LoITeDLBuOfIpCmgvozBN4MzlnG5Ft9l0JIo3xc= 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 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. 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.