Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7314089rwb; Mon, 12 Dec 2022 13:01:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5NcdfkF6lH+xwK1vy7rWXE1fQHioaH2yD6SANgA3gMiES3fA5RY0EZ8/xAK0NgeBtxpqLc X-Received: by 2002:a17:906:2493:b0:7c0:a49a:1 with SMTP id e19-20020a170906249300b007c0a49a0001mr13946044ejb.71.1670878863047; Mon, 12 Dec 2022 13:01:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670878863; cv=none; d=google.com; s=arc-20160816; b=WzcJak9X8wLGGLh/C0wF7RHqd16gSWp1cZAus7FOZ/VKulbU3wmKyjX+VrUTElPM6E qNihqJtohv3I7WXVwTug7Qf/v6+E2zVmLY/x3p5b5VY186zcsmqcnhLoA/sG8JxydNLz E9qj7dpFayCOQu9QrQ4XQIjThusuThB1nHLGAehd48K1SAYs6S2IV4FuL7s2zLjKHFiQ GEP93kgIraJkOOT/rhHG3aUVikcDV0CN05FQV0G6DQqNVoqb+U8wq3fEVpuV1NqHNdFJ TdWQh52B4E0Aj53owFj6gMZjME3AYMJF6G7TemKQlQlFr6NZJSl4SP6mfC03q5Q1p2TR 69wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=0dMhDUB72BePilNkVmMSswDSENS33OIY/8tXTH/slg4=; b=BiG7Z9lkGQ8aIw7krZURotoPQGp+CXlU+LdQq6/uNDO4Md7zMYn1aqpY1UN90IAERi aTmjQfd+YtzSemMdxwVgMoOUoW6N2Fhoo6NALVW5fyH0kkqIykDaAJf6Osms1NySKwF/ ZshDdBDZMWiR2IuHX6p3FRANjxMQqw8zzZlNEkDwwcqUaqEWSKUlIzekSjf1piU5Hxfd dM8g5aoOHPAeob2WmwrONrJ1dt2cs5FAGpcY8Gqej2EkjkvqbASSVlptjB7HyYTII5aC 0JyLSp24q61dfCxcYLxwfX13BllbHzo1ds4Hrf0JKHdHvLFkIh9dKivUVLZJnm3rrBrq dtjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VALgahzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd16-20020a170907969000b007c14d420f2csi5558896ejc.240.2022.12.12.13.00.44; Mon, 12 Dec 2022 13:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VALgahzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbiLLUgQ (ORCPT + 74 others); Mon, 12 Dec 2022 15:36:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbiLLUgK (ORCPT ); Mon, 12 Dec 2022 15:36:10 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C7A1583C for ; Mon, 12 Dec 2022 12:36:09 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id o127so15181899yba.5 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=Q2/TECAhX0z1wo9IbQJAerFZCPxa2fXNUQmdRKqH6+Z44pwNx0nuUhUbHqXDVM6Aja Q9v9SQVIcz5duPSb0yglzZWi01xSTxQy9Hn1g+cx/9X2L4MlNEESKlCOkbTAtnHfj/ZQ sWfDLXSW/t5IBRQAd44118KYMuHSX8Ue5ZnHFn/9mn3WLbcJ+Tc1wU6xFqlf+qTXbGip m9dPw4zdUedFPy12Uic9q/blvlVLOFOtc/M+xWhMBB7YfCEFw2PfTq7Y2OSedIcCDkP3 zXYWzoFx9UU8yXB44qTE47ijr28BA2AhaMX5sAQvorbOqPqK4u4MRBa1BmwSyd8Hqxej WD8A== X-Gm-Message-State: ANoB5pnZvxv0B6VANtH5u0mdVXQfz2O9HTr6l8G+aNHGEvCmVcffH9nR WJfQORNmX7hr/HquirS+Lltszw== 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-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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--