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 D44A6ECAAD4 for ; Fri, 26 Aug 2022 22:58:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58B87940008; Fri, 26 Aug 2022 18:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53A48940007; Fri, 26 Aug 2022 18:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DA79940008; Fri, 26 Aug 2022 18:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2C1FE940007 for ; Fri, 26 Aug 2022 18:58:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F18A7140563 for ; Fri, 26 Aug 2022 22:58:13 +0000 (UTC) X-FDA: 79843258866.13.209D04E Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf20.hostedemail.com (Postfix) with ESMTP id A6C6E1C002D for ; Fri, 26 Aug 2022 22:58:13 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id p18so2782809plr.8 for ; Fri, 26 Aug 2022 15:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc; bh=tSF+qwkpgisyyOiNPKDoHKcnwpvFmttW/6BP9nBSdVw=; b=iXOaGiwgwFoEenJr6PLeAhOxRagk5CupqeBVKB0cvX1IMvlk63kcnSUqcyt3mxYJ1U PS4s/peUIGrFp6OlTsXR1RBaxRiB3IaLQNooI90Vb5agyVv3gBe8IqaHT1Sce08RY1Uf 3UeAK2bjciN0dmTT2o01WyEChj9ddJ5eLjXPubxwRud9WQD2tSSAu8Kl6B4VSuxHqqgl fe9WpXOjbYKyvxfIKliFYxB1wsDFi1k7Rekp+0GmD4wQuMIyesnHohdMtIpyp8e8OXDT Csm54zlY58J/gueJ430nOOGq1V0TElbyW87QKDULUsqzgpFo70atT5MJ4GYh6DQS6ytA k4cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc; bh=tSF+qwkpgisyyOiNPKDoHKcnwpvFmttW/6BP9nBSdVw=; b=XVPOvZuGL1a0yzFuGkGRO3/oo4RiXs9htG15TFMFEXedxX7gLnp1KcWyDv9Z6Ytkqh WtmdBB3wN2mTnsX8WLlj8foOx8y3GOWiljbFyGs46TDELdM1OmMqanhGoEA08VWksN7O LMlRgjJ7JKDrEKwPj3LiRgvjuX4ETsfh2HbzEeP9qAtM3Z07lWON3E8oqY6Aq5EZvJP/ 06LS9y8yOIeF9Y1yWnWG7Iq6/lcXxQB/DJ/OtNwm1qdjSNzGfu6+eAmEjmXtRGzw4KlD xdzf/IiL6ZzsHxWNj6YFJ53IX7osyJj5JlVGJmI9lAVNh+LGjCkPskk/xEUIXJdmsfYV AUSw== X-Gm-Message-State: ACgBeo1eELQyOY4k4pY19hHPsg4MiboQKxyiwdKV300JVz1n2va0AEmz NtyPH+i4DLEnjBQzj3XxdDk8KnrFUdE= X-Google-Smtp-Source: AA6agR52NYRX9nMTppCZN1e92UAJEbjBWM6TS/PVW1tvML+od5A54EVK8PxljtrqglKJEKhmc9Dr/Q== X-Received: by 2002:a17:902:da8d:b0:172:edca:5735 with SMTP id j13-20020a170902da8d00b00172edca5735mr5753288plx.32.1661554692602; Fri, 26 Aug 2022 15:58:12 -0700 (PDT) Received: from google.com ([2620:15c:211:201:60eb:6401:167f:b157]) by smtp.gmail.com with ESMTPSA id x1-20020aa79ac1000000b0052b9351737fsm2334607pfp.92.2022.08.26.15.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 15:58:12 -0700 (PDT) Date: Fri, 26 Aug 2022 15:58:10 -0700 From: Minchan Kim To: Yang Shi Cc: "Yin, Fengwei" , Matthew Wilcox , Yu Zhao , Andrew Morton , Linux-MM , =?utf-8?B?6Z+p5aSp56GV?= , mawupeng Subject: Re: (resend)WARNING: trying to isolate tail page in isolate_lru_page Message-ID: References: <485f8c33.2471b.182d5726afb.Coremail.hantianshuo@iie.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iXOaGiwg; spf=pass (imf20.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661554693; a=rsa-sha256; cv=none; b=7m6CF82He3WJGbAvtRC6kx2dEr5C0IMyOFEccZ6qIYtT/870Rh9iI+UKLQF+eCBCAXOGWH /MsAslNqgkP1GXPWB76jx7Skr18O73utVHyhZR8L0BbXu8XKZECnZxGlQMpMCVNW1JqtNz XGQ9obEPeOCqX0xx+iZ2OaZcSK8BWPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661554693; h=from:from:sender: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:dkim-signature; bh=tSF+qwkpgisyyOiNPKDoHKcnwpvFmttW/6BP9nBSdVw=; b=z0tuGsaN5yywERp9A8PHEbsVebub/jAvgsQK7go7Tg9z8g7k+4dycuY6MuF6kV8jjeuNch UN2XT2U74Mj2Exlh5mvCwC8CaPj2a7QJbMindAi9BhX9+Ej53w42zGNvEjl9Kjs/M4T99o EtgIdyHN6DWh8oMnYKEbnO5CU3BqDlE= X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iXOaGiwg; spf=pass (imf20.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-Rspamd-Server: rspam07 X-Stat-Signature: 8qgpz4c65pm4u7pzymwdsed7hk3f65ry X-Rspamd-Queue-Id: A6C6E1C002D X-HE-Tag: 1661554693-585264 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 Fri, Aug 26, 2022 at 11:23:10AM -0700, Yang Shi wrote: > On Fri, Aug 26, 2022 at 9:56 AM Minchan Kim wrote: > > > > On Fri, Aug 26, 2022 at 11:20:58AM +0800, Yin, Fengwei wrote: > > > > > > > > > On 8/26/2022 2:46 AM, Matthew Wilcox wrote: > > > >>> Looks like my analysis from yesterday was dropped: > > > >>> > > > >>> : This all seems quite plausible. The reproducer seems to (correct me > > > >>> : if I'm wrong) create an AF_PACKET socket and mmap it. af_packet.c > > > >>> : seems to create compound pages and mmap them. This isn't folio-related > > > >>> : at all; I just moved the code that warns about it from mm/vmscan.c to > > > >>> : folio-compat.c. > > > >>> : > > > >>> : Looks like a long-standing bug in MADV_PAGEOUT to me. > > > >> Such page should never be on lru, right? We could test lru before > > > >> calling isolate_lru_page() for this case? I know isolate_lru_page() > > > >> does the check, but the tail page warning is raised before the check. > > > >> > > > >> Could the tail page warning be moved under the lru flag test? Seems > > > >> possible, but it should need extra handling (re-set lru flag). Seems a > > > >> little bit overkilling. > > > > There's a number of ways of solving this. I'm interested in seeing > > > > which one Minchan thinks is best. > > > > > > > > > > My understanding is: > > > PageTransCompound() return false for compound page if THP is disabled > > > in kernel config. Replacing PageTransCompound() with PageCompound() > > > could work here. But for the long term, folio should be the answer. :). > > > > Thanks for reporting and analysis, folks, > > > > I agree with Yang since the MADV_PAGEOUT should work with only > > LRU pages. > > > > From 0a43ac31c903bc23299a868a6d6724ff5b807e3d Mon Sep 17 00:00:00 2001 > > From: Minchan Kim > > Date: Fri, 26 Aug 2022 09:37:34 -0700 > > Subject: [PATCH] mm: fix madivse_pageout mishandling on non-LRU page > > MIME-Version: 1.0 > > Content-Type: text/plain; charset=UTF-8 > > Content-Transfer-Encoding: 8bit > > > > MADV_PAGEOUT tries to isolate non-LRU pages and get the warning > > from isolate_lru_page below. > > Fix it with checking PageLRU in advance. > > > > ------------[ cut here ]------------ > > trying to isolate tail page > > WARNING: CPU: 0 PID: 6175 at mm/folio-compat.c:158 isolate_lru_page+0x130/0x140 > > Modules linked in: > > CPU: 0 PID: 6175 Comm: syz-executor.0 Not tainted 5.18.12 #1 > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 > > RIP: 0010:isolate_lru_page+0x130/0x140 > > > > Link: https://lore.kernel.org/linux-mm/485f8c33.2471b.182d5726afb.Coremail.hantianshuo@iie.ac.cn/ > > Reported-by: 韩天硕 > > Suggested-by: Yang Shi > > Fixes: 1a4e58cce84e ("mm: introduce MADV_PAGEOUT") > > Cc: stable@vger.kernel.org > > Signed-off-by: Minchan Kim > > Thanks for the patch, looks good to me. Will you post it to the > mailing list? Anyway you could have my ack. IIRC, Andrew usually has picked up the patch in the thread. If he don't within a few days, let me post the new one Thanks!