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 8B535C4332F for ; Mon, 12 Dec 2022 20:36:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AD578E0003; Mon, 12 Dec 2022 15:36:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 95CE88E0002; Mon, 12 Dec 2022 15:36:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FDB58E0003; Mon, 12 Dec 2022 15:36:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 707128E0002 for ; Mon, 12 Dec 2022 15:36:11 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2CADCC0C11 for ; Mon, 12 Dec 2022 20:36:11 +0000 (UTC) X-FDA: 80234811342.13.89499B1 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf03.hostedemail.com (Postfix) with ESMTP id 5712A20016 for ; Mon, 12 Dec 2022 20:36:09 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VALgahzi; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670877369; 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=0dMhDUB72BePilNkVmMSswDSENS33OIY/8tXTH/slg4=; b=6cG9ekD5fUXqyGJxRPx+U7itIped5OKM+KQJr+cQZ3dXXx6uciAjHHriizScToTPigHTLA RPbcHqWjXl/VjMiRs7n5yyFROFu6buLq8mJdc5x/BbPiDIsZz14tu8x4yUoQ4mdhMpsA3H kkM3qjGOX4/f5V5MuyJw6aRbIrTSG2A= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VALgahzi; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670877369; a=rsa-sha256; cv=none; b=vdPR4tMgsmoIL2F52clkpKNEEIp20uX9Bgm+3qzduTGhphGBrqmgLzMr4hbMTrYC7rFfzV edSy6mGf/skPYNCLrfsdNdekEB4kmDG+hN6dAe2WJNTJfqeM/ejbtmJOTUSGj+8JChBIIw 58PaelAXsRBM++96Vi4UD6b3tVDKNLc= Received: by mail-yb1-f182.google.com with SMTP id d131so15206416ybh.4 for ; Mon, 12 Dec 2022 12:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=0dMhDUB72BePilNkVmMSswDSENS33OIY/8tXTH/slg4=; b=VALgahziLcR9p427xDFh1XxBekhCCtrDl4pBjEfh2MFdUvdlxk6GmUnHANnlKBxTrq UT2EJEOf+QZIwY5MuwEjMscuR9z06NdCkEQncgSDpjrXp3hodLWtoTvAQo3JNaJUsPt3 lfYRLgGZ8KnvKH951J1tZjKRSfbqoE7yPNDlP82ryW3mfqy4zkaKfMIJ1Fjs+JKSZqbG 0kuUD1v4dVYyOuKPIoeYIMU4cpd4WdNZVeQrmJamCWNsBo64DfF/zelPwOqeJJNn0bO+ ctjT6VTGvrPnF52wSj/K/IO0R1SHWMMZqwYEOncDltQghSuOHXndtIPoXWet6EuzajJs 1VSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0dMhDUB72BePilNkVmMSswDSENS33OIY/8tXTH/slg4=; b=uJOT8djMsYRhDZXbR8MWmKrr9V4YTcLqo1Bk8lsHI1WEOK3ygjaz2pC8YM6lqpRI0R t0aMsqPDiA/HbowMhgTeJfUGayHiONeYCySBXker1ds2mCZIRt7dKPAZx6N61H4sjKpS 0BBbg/dFSoV3W3G2TMHEBfCpAp6UmU9fxLeQx+vEdK9zdJJJ22OW9V32EBQTayaE03U6 eQRaR/TByC8ry7K1AbaBVuzxTOpcz/zmKJoWbREyfT15CPJUvNF05aAvtcl8TGfisixh l1TXZuEHdoRNPEYmj3sYtGjiV39Dnc8OvjgxP9Hqorb8Par+kAs61yaxJoXV4PUmKaCE ZBvg== X-Gm-Message-State: ANoB5pl2WMyBWQ+Uz1Rz3YPoaOvMPtDWdIfzsC9nvT7xdL27YtPTO+g7 wc58wL+M8tKjzqQMlWJAXz0GIw== X-Google-Smtp-Source: AA0mqf6h644TKANgzkwZdoDdLgr7HeNuK8OcwsM2S18P04rc7i6iDBJNXLk38X3w9fCLS4GfX/1vZA== X-Received: by 2002:a25:5906:0:b0:6f9:c559:d531 with SMTP id n6-20020a255906000000b006f9c559d531mr16917809ybb.35.1670877368205; Mon, 12 Dec 2022 12:36:08 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id bj17-20020a05620a191100b006b95b0a714esm6485115qkb.17.2022.12.12.12.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 12:36:07 -0800 (PST) Date: Mon, 12 Dec 2022 12:35:57 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Greg Kroah-Hartman cc: stable@vger.kernel.org, patches@lists.linux.dev, Alex Shi , Hugh Dickins , Johannes Weiner , Vlastimil Babka , "Kirill A. Shutemov" , Alexander Duyck , Andrea Arcangeli , Andrey Ryabinin , "Chen, Rong A" , Daniel Jordan , "Huang, Ying" , Jann Horn , Joonsoo Kim , "Kirill A. Shutemov" , Konstantin Khlebnikov , "Matthew Wilcox (Oracle)" , Mel Gorman , Michal Hocko , Michal Hocko , =?ISO-8859-15?Q?Mika_Penttil=E4?= , Minchan Kim , Shakeel Butt , Tejun Heo , Thomas Gleixner , Vladimir Davydov , Wei Yang , Yang Shi , Andrew Morton , Linus Torvalds , Sasha Levin , Gavin Shan , Zhenyu Zhang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 5.10 001/106] mm/mlock: remove lru_lock on TestClearPageMlocked In-Reply-To: <20221212130924.929782499@linuxfoundation.org> Message-ID: <8ad6ed6-5f7c-f1cd-8693-caf88bfca73a@google.com> References: <20221212130924.863767275@linuxfoundation.org> <20221212130924.929782499@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1463760895-100399986-1670877367=:4310" X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5712A20016 X-Rspam-User: X-Stat-Signature: geyrfr785ahxsytwnkaa3t36cntjnza8 X-HE-Tag: 1670877369-253095 X-HE-Meta: U2FsdGVkX1+NCJ8BkhpeHO7GYcVtrwruA8ENlxIAXmhvSrk5wk5Lho35SZGtAwOMFwQDnC0te65h9TgpwGneu5qIQQ8mkqgugbfz4BlQYJqGsjFncYGjIwyHw8MhAAk5QD/g1MVXMfLVUGQq6LGZvwdOCxj9jC4bWhowukrcv0dhf3DoVQoZBN0+m7RnnCPH7Ur5CeBVjH2tZoom6zjlmsFKbSu8zOU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, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1463760895-100399986-1670877367=:4310 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 12 Dec 2022, Greg Kroah-Hartman wrote: > From: Alex Shi >=20 > [ Upstream commit 3db19aa39bac33f2e850fa1ddd67be29b192e51f ] >=20 > In the func munlock_vma_page, comments mentained lru_lock needed for > serialization with split_huge_pages. But the page must be PageLocked as > well as pages in split_huge_page series funcs. Thus the PageLocked is > enough to serialize both funcs. >=20 > Further more, Hugh Dickins pointed: before splitting in > split_huge_page_to_list, the page was unmap_page() to remove pmd/ptes > which protect the page from munlock. Thus, no needs to guard > __split_huge_page_tail for mlock clean, just keep the lru_lock there for > isolation purpose. >=20 > LKP found a preempt issue on __mod_zone_page_state which need change to > mod_zone_page_state. Thanks! >=20 > Link: https://lkml.kernel.org/r/1604566549-62481-13-git-send-email-alex.s= hi@linux.alibaba.com > Signed-off-by: Alex Shi > Acked-by: Hugh Dickins > Acked-by: Johannes Weiner > Acked-by: Vlastimil Babka > Cc: Kirill A. Shutemov > Cc: Alexander Duyck > Cc: Andrea Arcangeli > Cc: Andrey Ryabinin > Cc: "Chen, Rong A" > Cc: Daniel Jordan > Cc: "Huang, Ying" > Cc: Jann Horn > Cc: Joonsoo Kim > Cc: Kirill A. Shutemov > Cc: Konstantin Khlebnikov > Cc: Matthew Wilcox (Oracle) > Cc: Mel Gorman > Cc: Michal Hocko > Cc: Michal Hocko > Cc: Mika Penttil=C3=A4 > Cc: Minchan Kim > Cc: Shakeel Butt > Cc: Tejun Heo > Cc: Thomas Gleixner > Cc: Vladimir Davydov > Cc: Wei Yang > Cc: Yang Shi > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > Stable-dep-of: 829ae0f81ce0 ("mm: migrate: fix THP's mapcount on isolatio= n") > Signed-off-by: Sasha Levin NAK from me to patches 001 through 007 here: 001 through 006 are a risky subset of patches and followups to a per-memcg per-node lru_lock series from Alex Shi, which made subtle changes to locking, memcg charging, lru management, page migration etc. The whole series could be backported to 5.10 (I did so myself for internal usage), but cherry-picking parts of it into 5.10-stable is misguided and contrary to stable principles. Maybe there is in fact nothing wrong with the selection made: but then give linux-mm guys two or three weeks to review and test and give the thumbs up to that selection. Much easier, quicker and safer would be to adjust 007 (I presume the reason behind 001 through 006) to fit the 5.10-stable tree: I can do that myself if you ask, but not until later this week. Hugh > --- > mm/mlock.c | 26 +++++--------------------- > 1 file changed, 5 insertions(+), 21 deletions(-) >=20 > diff --git a/mm/mlock.c b/mm/mlock.c > index 884b1216da6a..796c726a0407 100644 > --- a/mm/mlock.c > +++ b/mm/mlock.c > @@ -187,40 +187,24 @@ static void __munlock_isolation_failed(struct page = *page) > unsigned int munlock_vma_page(struct page *page) > { > =09int nr_pages; > -=09pg_data_t *pgdat =3D page_pgdat(page); > =20 > =09/* For try_to_munlock() and to serialize with page migration */ > =09BUG_ON(!PageLocked(page)); > - > =09VM_BUG_ON_PAGE(PageTail(page), page); > =20 > -=09/* > -=09 * Serialize with any parallel __split_huge_page_refcount() which > -=09 * might otherwise copy PageMlocked to part of the tail pages before > -=09 * we clear it in the head page. It also stabilizes thp_nr_pages(). > -=09 */ > -=09spin_lock_irq(&pgdat->lru_lock); > - > =09if (!TestClearPageMlocked(page)) { > =09=09/* Potentially, PTE-mapped THP: do not skip the rest PTEs */ > -=09=09nr_pages =3D 1; > -=09=09goto unlock_out; > +=09=09return 0; > =09} > =20 > =09nr_pages =3D thp_nr_pages(page); > -=09__mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages); > +=09mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages); > =20 > -=09if (__munlock_isolate_lru_page(page, true)) { > -=09=09spin_unlock_irq(&pgdat->lru_lock); > +=09if (!isolate_lru_page(page)) > =09=09__munlock_isolated_page(page); > -=09=09goto out; > -=09} > -=09__munlock_isolation_failed(page); > - > -unlock_out: > -=09spin_unlock_irq(&pgdat->lru_lock); > +=09else > +=09=09__munlock_isolation_failed(page); > =20 > -out: > =09return nr_pages - 1; > } > =20 > --=20 > 2.35.1 >=20 >=20 >=20 >=20 ---1463760895-100399986-1670877367=:4310--