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 043E5C3DA7F for ; Sun, 4 Aug 2024 17:52:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E4526B0082; Sun, 4 Aug 2024 13:52:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 692426B0088; Sun, 4 Aug 2024 13:52:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55C6F6B0089; Sun, 4 Aug 2024 13:52:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3898E6B0082 for ; Sun, 4 Aug 2024 13:52:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2D68041A86 for ; Sun, 4 Aug 2024 17:52:10 +0000 (UTC) X-FDA: 82415306820.29.06BF850 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 37228C0018 for ; Sun, 4 Aug 2024 17:52:08 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QFHLgijJ; spf=pass (imf22.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722793880; 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=i3YCZS07cQ35Kj0LfJ2+B/Sg0JjvIE06picC/2XMeC4=; b=iqufvHt6q7nB+syPIoIuyGzyIvqyyBSkaQ/5BRdycSwtciwyb1F/36LDs07yOKITRfy7M3 D0FFtkM70bTGmignBBOL97A5ijztC//7u7sJlGe+Llb1yGwQHXNlno/ms7o97ltiqoUudW +gZKIG22m2tE07QIR4IuVqhJn2aQkig= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QFHLgijJ; spf=pass (imf22.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722793880; a=rsa-sha256; cv=none; b=TnbMWE0kOJEHHuHKpO36LPR1wCi1+bsdBvHYhDM6edVanu/VD5YusEdOZ23+YNa+WoEGdN NeQTBUa8Y+VIqwmVkuA9lFvoWg+tvG/YFAgLjcP48DmmuwkSn0VCWMrhTqAh4rAsXvN725 Ery/uAYxITxZhGVAmxzgLNJrkj5X2Y8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0C79A60AF9 for ; Sun, 4 Aug 2024 17:52:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4875DC4AF15 for ; Sun, 4 Aug 2024 17:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722793926; bh=M6rWXZf52qIB+Mm9mbU8jueBVd1OR1uH8vfQMN8Q+3w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QFHLgijJf+7B9dQqaPB8dB3AAoCQB4Q2G40f9FBIpUxyK8sXyy77KnL9+eSb6ierd fIvvEs7ah+GIHGSBMYer6SjPCAdTWIg/DR22exrMQ0wyKEqhQdd5jYuCmV5UNjA11S hdOxRKd4jg3V3C1++DaoLm5PudzlKle8wOHpz3KLIxe818uI4qNTv+rm5m04IoRtU3 wOEjyus4D9utMs3RLSPxG4VXaV2OHQZhXWm6XJ9sAcltcqV7hnNbOvQiXBZS7PTIp5 /qK1ZP2FOGk/enyaSvKINEqLicx1cN4IgWvU7RRc90XuriT+hA4mOYIzIUUPtGu2j4 rgdzAYn4WY4/Q== Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-67682149265so79646687b3.2 for ; Sun, 04 Aug 2024 10:52:06 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXk172tP1cVC06gteTiKewJUau3OE+rm6ziyBlIrawwv6IN9NwnwJOFf7XKDQVlxtNr8Ri/cmwhX+kiy03LKwpmOyU= X-Gm-Message-State: AOJu0YzcsOAMkO/muGieOox7i8sOEt1aBQBMyFPkyK6Kvs+NEb+HJOs7 iGzPpvccAIexNKA4Y7ujBUFn8AqWbSqWjvZmzYMQnb+uvI3Mg0Ax5+0NMuOkzpkwybfl1fYxsLW T6oHsELq6vemCcN/01/WF2YLxw+eX+Abw7URfSw== X-Google-Smtp-Source: AGHT+IG8rqmKvFu0oePREvl9xWibUHtyMYHj/OiX5IKUkVz8roXdJrHtnmfFBi0m7m9mKhYS4OWM5/Hm8dUGnRVO1og= X-Received: by 2002:a81:c242:0:b0:65f:dfd9:b672 with SMTP id 00721157ae682-6895f9e5cdamr102427917b3.11.1722793925477; Sun, 04 Aug 2024 10:52:05 -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 10:51:54 -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-Stat-Signature: esau1qufemjo9uxmx31cufaabf143nu7 X-Rspam-User: X-Rspamd-Queue-Id: 37228C0018 X-Rspamd-Server: rspam02 X-HE-Tag: 1722793928-835846 X-HE-Meta: U2FsdGVkX1+HBntHa6vWpk0NYorFUXMl9jd6Vw6NVPowCFYsX0tcKHClhGSHtFrvHGsjSPvgfs3XHBg6k5ugexpUox19apBpW7JtrqcKlnE/a+aMQy2gshUUqFQkbO9fEEfuQqbHb2LIZNU/aYuXNMfoNRSfS1zvzhH6iIhw9yJeaQRdT+Tq/box1DUaGB/SK+K2+C0DNHuYbHkVAZDX9fEfk2P7EvT08u71WD/9rLW3xQ41EyQFPzCTioTF4PFkwy2ewSDJYoHlz36JSF4Yr4/DMtppQWEXhOrwoXOUfopFKcEL8k3irvTnwnBVyhLXJtDDk5bhEBWEdOaj5smt0t5fwFu0g33fiyw5n8F8cf+t3LHVDbOq+DK/ZxrCdBU1INGmLuW+zT8/7V8sil+ps1DnS9rSZ/HNYP4VNayHLjAD/7FfhNHVnZNg2w6B84HbLQHG5vfnOBOCQOXQc8qbHLplBHWod50KKU1kzMYR6+QmFhCkRc31/GXstzLWImZ/UGJ91ubLzXstsiqLa/3bZ4yEOYhUO5FEkZDM5fdUWAZKXEu3tS85TMw44rPO2a3pWlOKOcE4Ypqezs9l4gufTHtqeUdFY4CfNgeEW+NLUllqIGNh5QnHtfO7bM1nEFnqsEjCPvFAAX/lq2z4oTV+QvpKp2vt6gE92w802Xqg4GtNdtB8oGAAhxenJF5ZPe5VlINwLMSwJ3H9aACsa9EE5D6kiuIZBjLdb6zRii3HLFmeIP0wRveoHXym8NE2binju6lSiuE0UxhA5WFRgtWh52s8zmYgopaMmRYaYhDl9BXi9ShrKLsTbRZgQB4hLdcKEDI63Oh1iKP9vRh8tYqd+XYcY2yipRR5subelyBetphAn88n+OBdX+d8gOnodTNX9uPCYRJs+LdUDF/j91cNAB1EyZBP82lbXSzKNOJqTu3MS2K0WN2MXhkgfQjdECuzW5UHP1vPHVislmpadiS oLiL0T1V E9XNrsQBIvSzkCnXC32sfEfjfjA0ftOQvJWyc51iqZG0luf+cgAOwGzhmhKiG6IlCvBQCnbxzCRotS+ULAthUmkjcOJXpeceJ09vyh55b1rovAT4gSpHLnIl+phZ84Is/ueBBkc6jC1nWI8aNqfADEj2XVlBwosEDGN7K1eXG9Y30fagUx6XXEmfT+y6AL5BEQp+c6iIJnmqATpnMKEXc+G5uV/4a11go74nyGIAE0yX7C0/vIGhhgQHQLykyT6BL6MAPfBNvOEVSMRfDcBQLoEQt9ZwPSZu19vgNm0S+35NqwdYYZcRtG+7+RQ== 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 5:22=E2=80=AFAM Kairui Song wrote= : > > > 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 57r > > 617e 0p > > 1 0r 0e 0p 0r > > 4e 0p > > 2 0r 0e 0p 0r > > 0e 0p > > 3 0r 0e 0p 0r > > 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 57R > > 238T 0 > > 1 0R 0T 0 0R > > 0T 0 > > 2 0R 0T 0 0R > > 0T 0 > > 3 0R 0T 0 0R > > 81T 0 > > 13807L 324O 867Y 2538N > > 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 f= ast. > > > > 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 encounte= red). > > 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. Chris