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 AAB00C3DA7F for ; Sun, 4 Aug 2024 19:11:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40F746B0085; Sun, 4 Aug 2024 15:11:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C01C6B0088; Sun, 4 Aug 2024 15:11:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AE836B0089; Sun, 4 Aug 2024 15:11:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0D9E06B0085 for ; Sun, 4 Aug 2024 15:11:25 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B4469A1A1F for ; Sun, 4 Aug 2024 19:11:24 +0000 (UTC) X-FDA: 82415506488.12.5130541 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf05.hostedemail.com (Postfix) with ESMTP id 27BF8100017 for ; Sun, 4 Aug 2024 19:11:21 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sYA6ZAeD; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=chrisl@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722798615; 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:dkim-signature; bh=BDc0QT3EaieX1D2pkfNrw3mxdLwX+v3HhQBirt0QjlE=; b=lCl2GesTXqISMvMtZv1QVmRWhS9sbECrWBYkG2ifNf0p0sDPNkJs7YGg1kMclq+qeIlxH/ ByTNmriVa0nIyfpJ7e9vt+V+cQ/GHTk9ZcO2SN7qBqbMqYUx7IsKtnqOnNy5wh5ufqr8/v 56FyBDP9lBDAs2gcbqq7KfYB72VuaMc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722798615; a=rsa-sha256; cv=none; b=1yUJl+Zjd9U/CUE2CRT8qXfx1DZkLwyl5vl8ZqGlj3pUDYHKXadVeOuMTnHn6V1CKOLhk6 JQbq3mUqC8Djyqw8wn1fRaRjF05w3BbYPZU0by9t1mxkyLbiVCGCG5mGch3gcFQ0R4kWe+ k2kKyxDohhNooV2swX2qVq9NUF+zAHc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sYA6ZAeD; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of chrisl@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=chrisl@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BD527CE01B6 for ; Sun, 4 Aug 2024 19:11:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAE29C4AF17 for ; Sun, 4 Aug 2024 19:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722798677; bh=zCHyjwJy6TODD6BRPU486rpar5QR9t0oYZivvlXqf6s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sYA6ZAeDNC30bq5rf1X56xQQk+ZYwPbT8ktdv05OK9pKESGyH36UEGFG03wzNavou EvQYPbcYpRQ9WNlRVHC0eRJ46AcP8f6QUb1WxGFZXwV4/5eRmYpSLNESEaVFEmnHTp 42dtW4V4HD8mb0C4zuIOEvMgtoT6cmbx4Dmwa/Tjwwm6U7o8oChh+x7AJLLL6MSMUh H2TQsH6UmJZ27HBCUZhTzJIkzpfD5Ey034JU29kW9JQmwVTQrjMAARPa034kmEm0Y0 E5A0/hBBNBiJMwnkGnDcqrcQ9rhQX+hhgdgavzfl2wPm/XZb7kEgp27f2SyuBdsnEE pPiSAA2KE5imA== Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-65fdfd7b3deso83097347b3.0 for ; Sun, 04 Aug 2024 12:11:17 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU5TAYRfkTnfxpDZS1tySIXSZ3MNFCJtVPJygbEE8VqDXBAg208oQ4UrZFfb711injIPWmB8oTyNuK1AiL+0gIu8FM= X-Gm-Message-State: AOJu0Yy7u9TPTTV7y1a06AJKQgVYX4oGwKCaFbM7zwIMkmx798345BAT KNM57QDxEPOinAxESHF5jsJuaWo5tbNMBQ0tFeHk27p9HZXXyyOToCFNvGY9H2dfrCBDIcYt5oa PngprCxtap1l3C7GSJqpi92yeESlEffp/164xUw== X-Google-Smtp-Source: AGHT+IFdYqWYjZxjWfKoZc2K8ta1VmIOXPkbqU01TmEirMTITJ9Fd8Ev56SH9e8i/5wdnonsShVfMz4BN67kSDekIRw= X-Received: by 2002:a0d:c981:0:b0:665:657d:9847 with SMTP id 00721157ae682-6895f9e5f6bmr100332707b3.13.1722798676947; Sun, 04 Aug 2024 12:11:16 -0700 (PDT) MIME-Version: 1.0 References: <1719038884-1903-1-git-send-email-yangge1116@126.com> <0f9f7a2e-23c3-43fe-b5c1-dab3a7b31c2d@126.com> <00a27e2b-0fc2-4980-bc4e-b383f15d3ad9@126.com> In-Reply-To: From: Chris Li Date: Sun, 4 Aug 2024 12:11:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] mm/gup: Clear the LRU flag of a page before adding to LRU batch To: Kairui Song Cc: Ge Yang , Yu Zhao , Andrew Morton , linux-mm , LKML , stable@vger.kernel.org, Barry Song <21cnbao@gmail.com>, David Hildenbrand , baolin.wang@linux.alibaba.com, liuzixing@hygon.cn, Hugh Dickins Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 27BF8100017 X-Stat-Signature: umhxiddwuz7jgp6ojneu7mw3yhaohysd X-Rspam-User: X-HE-Tag: 1722798681-150422 X-HE-Meta: U2FsdGVkX18+18Ft76a66nlYRU6kk4Mg6/VlY+vZodXLtDpiKmOJlvbCDuaTa76+0z9OwhKMFOJdpwa3mt8sFQA5b2FdllQUS5evLvjobo/ghPCsRcNGgVoFMQkZ4Gtu0gEeSUjJBFXZ/ULG4aKRfeUtfb/i9E0xrOSSeULJLhrVJQ47V5GL64ngzBwu3ydGXjES/wHmSLfahR08bpAgZ9jJUQrcLKne+NyOgVbLqRND9CGbA68uOFZQoyReq18gSF52MpR11EH8wu8EYYXKTJbYBDp42Tv5ddl7yM9t5RNtd/smYfbqz5PSrCIBylkc7FY9AGTsRLfo3Y+zXOHodl1Ec9fuKpy+Nug9S/bBr6v/9upk5VdAzJzqRsifndqx+kcE0Do9SP8HqDA2QPOoWLYUC8cKJa1xnTLlXDOgoONVHPNoYR3Hy8t7Y2kLKMOzJhfhStpeL06I4jWQ4RSbjt6hbZ9j4r9LdYFd0czDnHGDyN71vQ2dQ/zAQ/7iNJORzXmchaJbFuk4x8L3yRR9o+w7NYlOP4LYGQUuFfySukqUfjAmlZK4yJ5ZuSRzMvTqkx8kABztfiMVMqCv55adXjoZcxsnoBiU0uC1sbm4b9CZoSfHuM+VblfyrwFALfYl1c9PYqQJsChF5MOx96sPMq3IQvgc4NyESVhUuCeDoXxSB7AmBYNAuc8NbD1ZyhPYa0eQuZCf8BiAIC7caF9ZXVkZtKRnZGRpYRj0BGQyNtwvXJpGDIQ3k+ZfnkoLjxwVMTkEEnAuCsWEG6ogLOiWyV8966sEufnuoucRIACbT8hWFuDTKeN3lV+zC5fM+rE2yEDwbewpEGun9iJCBK/OZQQgCfY1nYUtnK1OMQxfWxDlw9EIYSiHEoalg7dNYej+hy93xUnas2rmS4fqla46fUHtUB9qC5boB6laBWYsqnjUIaOQIyNKH92fMfeeEXjx0WJlGb1jrzBdnqxrtuT Ayswiyk4 RkK4rJp6fuhw0M43rMQT9XqnvVlwl5mMJH0OJeZmtcVtHLnB9DJjBRTdW0ArfvR9cEu9Wp+3dUfzR//eorqE/ygU3kfanY9m1yPEEMYPdxc9HxUKqEx48N847XrRrNkSZ6NE0SP5I/88QZD6edD06H0Z3/CpDbv2YAPVQZCrMF+CSIdv/V6+ukvkcgIbL1OrMuDyXU9uXWMxjXmDuTGeVD3BeDWbm28Mvysk0ocDOEMe/TrU/YfeLAPwzSV5fUBprLJ6zisEg1XMBKI4W8cGlSpt4MfEA8e0I4FvxFiHddHWExzOW326SAPAeyRecnaAad4B3vTZ4vWzTlz+qKevpT/YfI/esbavcJW79+I6tHwiblAo= 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 Sun, Aug 4, 2024 at 10:51=E2=80=AFAM Chris Li wrote: > > On Sun, Aug 4, 2024 at 5:22=E2=80=AFAM Kairui Song wro= te: > > > > > Hi Yu, I tested your patch, on my system, the OOM still exists (96 > > > core and 256G RAM), test memcg is limited to 512M and 32 thread (). > > > > > > And I found the OOM seems irrelevant to either your patch or Ge's > > > patch. (it may changed the OOM chance slight though) > > > > > > After the very quick OOM (it failed to untar the linux source code), > > > checking lru_gen_full: > > > memcg 47 /build-kernel-tmpfs > > > node 0 > > > 442 1691 29405 0 > > > 0 0r 0e 0p 57= r > > > 617e 0p > > > 1 0r 0e 0p 0= r > > > 4e 0p > > > 2 0r 0e 0p 0= r > > > 0e 0p > > > 3 0r 0e 0p 0= r > > > 0e 0p > > > 0 0 0 0 > > > 0 0 > > > 443 1683 57748 832 > > > 0 0 0 0 0 > > > 0 0 > > > 1 0 0 0 0 > > > 0 0 > > > 2 0 0 0 0 > > > 0 0 > > > 3 0 0 0 0 > > > 0 0 > > > 0 0 0 0 > > > 0 0 > > > 444 1670 30207 133 > > > 0 0 0 0 0 > > > 0 0 > > > 1 0 0 0 0 > > > 0 0 > > > 2 0 0 0 0 > > > 0 0 > > > 3 0 0 0 0 > > > 0 0 > > > 0 0 0 0 > > > 0 0 > > > 445 1662 0 0 > > > 0 0R 34T 0 57= R > > > 238T 0 > > > 1 0R 0T 0 0= R > > > 0T 0 > > > 2 0R 0T 0 0= R > > > 0T 0 > > > 3 0R 0T 0 0= R > > > 81T 0 > > > 13807L 324O 867Y 2538= N > > > 63F 18A > > > > > > If I repeat the test many times, it may succeed by chance, but the > > > untar process is very slow and generates about 7000 generations. > > > > > > But if I change the untar cmdline to: > > > python -c "import sys; sys.stdout.buffer.write(open('$linux_src', > > > mode=3D'rb').read())" | tar zx > > > > > > Then the problem is gone, it can untar the file successfully and very= fast. > > > > > > This might be a different issue reported by Chris, I'm not sure. > > > > After more testing, I think these are two problems (note I changed the > > memcg limit to 600m later so the compile test can run smoothly). > > > > 1. OOM during the untar progress (can be workarounded by the untar > > cmdline I mentioned above). > > There are two different issues here. > My recent test script has moved the untar phase out of memcg limit > (mostly I want to multithreading untar) so the bisect I did is only > catch the second one. > The untar issue might not be a regression from this patch. > > > 2. OOM during the compile progress (this should be the one Chris encoun= tered). > > > > Both 1 and 2 only exist for MGLRU. > > 1 can be workarounded using the cmdline I mentioned above. > > 2 is caused by Ge's patch, and 1 is not. > > > > I can confirm Yu's patch fixed 2 on my system, but the 1 seems still a > > problem, it's not related to this patch, maybe can be discussed > > elsewhere. > > I will do a test run now with Yu's patch and report back. Confirm Yu's patch fixes the regression for me. Now it can sustain 470M pressure without causing OOM kill. Yu, please submit your patch. This regression has merged into Linus' tree already. Feel free to add: Tested-by: Chris Li Chris