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 68398C5AE59 for ; Thu, 5 Jun 2025 06:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D81EA6B01A8; Thu, 5 Jun 2025 02:32:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0B586B01A9; Thu, 5 Jun 2025 02:32:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFAAC6B0208; Thu, 5 Jun 2025 02:32:50 -0400 (EDT) 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 9D7436B01A8 for ; Thu, 5 Jun 2025 02:32:50 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4B8881619CD for ; Thu, 5 Jun 2025 06:32:50 +0000 (UTC) X-FDA: 83520378900.19.04582AA Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf04.hostedemail.com (Postfix) with ESMTP id 4E7D840011 for ; Thu, 5 Jun 2025 06:32:48 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b="M/bExigk"; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749105168; 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=3lSOF0EtBbyqxKKcvWaFAuAauvCX/Qj9zdt2j6KevZM=; b=38P9ejQhUhAOZ9ekPOhPew1Req5Zvy9JbxAZf8+DK3LtJZWPjlIVetZ/GouUQU+O7q0W3Z Or5DAYGOuM+xWiNpFeCqmlVEmdrtQAGPmEBmcaQVBu5Jk1VfplPZ9fWdwuTVh0yNnIK3pN L9pj9/hJe/77/1Vixu3ke27z4iM2cos= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b="M/bExigk"; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749105168; a=rsa-sha256; cv=none; b=5fB3K38muqYtv48xmW10ua26ueJhKtoH4cC/5UoKobjSLqu1sR6gkAI09jM9dD8xCinP3N XtC6zeESoSEwTtu8rHJNnW//4EqgEvlIsiPJYREMsB2OM3ksF4H1Z40OC3KaZ99JDFsCaI jg2TjHGI3bOpHngxU76OcnuK4KWLsA8= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-acae7e7587dso97329766b.2 for ; Wed, 04 Jun 2025 23:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1749105166; x=1749709966; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3lSOF0EtBbyqxKKcvWaFAuAauvCX/Qj9zdt2j6KevZM=; b=M/bExigkLuwYQok5g+2rfwXjAg1UaNFgYMTflARIGKkuKuAIbLvEsWm16QK7S307Xu VvPK+4KLPom3C7k7aSZaMdCrGwCkL/NRnqq1njvyTWikoWuE3fc2H7ra+YHl1xDLxvfq BlGctKjZCytM23jFsQ2ec1L5SRN+L9gxEUJfKvd5ksoDZNetXRbIGP8JZyqZ6yYEfFqZ FU69cJLrPQBThRr6szMWe88oxMZuDoOt+sfjsoO3KQKhoaK4hVVCocuO6mScRFMvnrsB 5Crb0x5HSQjLsLIUwT5xCiDO2HbUwyRlCyzJRdstaEo4fAWddR2ruTVwLw+N8RKvBV/d iecg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749105166; x=1749709966; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3lSOF0EtBbyqxKKcvWaFAuAauvCX/Qj9zdt2j6KevZM=; b=JYm2ShXSQCvhPXkNvI/iDON+oNRH0SsbR7LP59MRiEfV4ABLHikTjXJNLW8TmhbP9B Io5mwf06kUg9ujDE/n/SftI3tE7e4VwBrRv4xbNuI0I5XNNEMprxkxnZB5zzaGwbTxN8 maDJx3VWIZuJtrMbkuzcWegbdDxpYgEs10OYPus/ZPGiXXKNWey+643OanyoRNqTqqA4 jHC77Gbgem3iHbWPqqqbMlgXHs+p/hNkTINe+WHfdRDUMdqHBmfQR+kpD6mr/jRJhU0E QpXuAcz632+1S2dbXkgm6OypC0JQDnNCuBnvcSurC7XyijILvfXdr8OUxHwlnhe679wR hogA== X-Forwarded-Encrypted: i=1; AJvYcCU6QCsBiJqki8BG53IH6pKhZsi35RpSGJvLBNPAOeunnfSjMCtp8+S+m1XHsHuynwYSFFdHSYue/Q==@kvack.org X-Gm-Message-State: AOJu0YxxJqVTzkuCMrz3Jj/WbRJqvy6vmKjbK1SuuLXVjEg0ONxbwMIM 52hKnDm2HYgbS7CAw0K5UGjZq5LWQdXcEQlRuy9116xNPV7P5tOxcPngPdWFb3UeZLg= X-Gm-Gg: ASbGncsLnNDC6d+w6RwfH6A1l3Z7LR05qSPkBNu4ZhhmPK+IJmJ5qmiPzPYLgUUhlVE qWgsIbvrKyyP4nvN/ampB/d6dMeGbObx0oPKWFuiSdu8HxoYtfJ/X2rieMiCQEFvbo/0B7l7sep IgSBiRSNMqDpkj78iRmZ4txjEBsngKiHlShBGTbHdxC5PgM0FypQGZv62X0IoS7IyiWKc8+9b8E i9nHeBlLVnLVaD1udKkLs7dPHyp/5KKSzNpbaATUKW1wCPb4ozV4kaUp/X/KWRKfVjXhk68bMns LmEtA+PXji8iMYlFR8pJU/+yczJYkVt482WIH1x/PhOvyFaahn3UfCgavQ1LT0Pt X-Google-Smtp-Source: AGHT+IG6tFvgSjWU4ETeIFzDsF5SwAK4ctDL8+HRHWpaT2Wob1h8vxQM68Y5aUX0aVGhDQl+FZHLFA== X-Received: by 2002:a17:907:3dab:b0:ad8:ae51:d16 with SMTP id a640c23a62f3a-addf8fc9887mr488019166b.55.1749105166500; Wed, 04 Jun 2025 23:32:46 -0700 (PDT) Received: from localhost (109-81-89-112.rct.o2.cz. [109.81.89.112]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-ada5e2bf029sm1198020466b.115.2025.06.04.23.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jun 2025 23:32:46 -0700 (PDT) Date: Thu, 5 Jun 2025 08:32:45 +0200 From: Michal Hocko To: Baolin Wang Cc: Shakeel Butt , Vlastimil Babka , Andrew Morton , david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, rppt@kernel.org, surenb@google.com, donettom@linux.ibm.com, aboorvad@linux.ibm.com, sj@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: fix the inaccurate memory statistics issue for users Message-ID: References: <7307bb7a-7c45-43f7-b073-acd9e1389000@linux.alibaba.com> <250ec733-8b2d-4c56-858c-6aada9544a55@linux.alibaba.com> <1aa7c368-c37f-4b00-876c-dcf51a523c42@suse.cz> <985a92d4-e0d4-4164-88eb-dc7931e2c40c@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <985a92d4-e0d4-4164-88eb-dc7931e2c40c@linux.alibaba.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4E7D840011 X-Stat-Signature: xcgr8sa7sjuyrx1cccqddqkt8qd5ixin X-Rspam-User: X-HE-Tag: 1749105168-473298 X-HE-Meta: U2FsdGVkX1/+OZX2f45J5YTMoWGxLCBqjIleexonZQwrBRSqc0gDLmKAvSle3LGx/mVNr08z1VnTuyU+TubIqxDHz1YcUVjiAoknaS8pRHXz8Xyy+rghlH3fqw/Ty8X6HP7csRmjOfTAPgc8SPXYDWrz9GIj9RhB3K7b/+B2HC1QLNycpuOMMMFDUw1GEJdFWh2nERNO8uisig31YBO0GpEC0+b3SJfsDvSP+AOZPgNr3ah7xZIHUVER9usgHvFRKYMv/jX+hN5+J8O1J0ix1yVt3LK5p8wQ4ud5xzTk7w3xdXgy7YtMZSMuKtzKJUM84dcoMYKHfi7uLHIZw7+9XUOIyEu3nRKRARTGARwkjXFENl3DQK3BGomLbwxmjSom1B6WMz1WUWowqlttpVMuWqHB6gpdTpefHBL16WH6tjkUcGTz66bouTHCrD+3b98Nt+fdHv/RVbmmBHpRPCjsfStOy96nXK45sldvbdvsYM8mfdcRNIetaIFAsOpvkKRkYcv6kybtIPpcDMXnLqWMtS6bg0ApKO4NTKf44bLFPZ0C9uyUc1ocLtfuLsViNX8Kllpnwfc7neR3Axn5Y4RiXvB2s4lZ+yiR3S2d16xldmrUoj7VbKZv89Kt4vUuHInHbn4ssGpe7JTi2knn+jeMpqKWy/2WtAhJ80pgnc3Kjnw3F+ppZh8ImYRMlJL+Di9ykaAH8sVKFGrV6rwq0N3TULmP+MLy1lTTEjYxYbUN9BlzNbHPbxqnckpIZClzgfzKXYcByO6KNhQa9lbFSec+1PISv52THaAu5rbvK/Zf9NDjnOCWEmbf//wuUgXNGbVSAVQLDEpi87Bwm4B/dAepajngSQbBxq5UFvPh6UkBWV5DgXb7z5yLZZYAcW6Z/6IAJB7da2VGRaoDWkEVWjTRcNBUynZnLqGZxM5ZCp13vlBxrLsHFUE3RrO6gDT2Ut1wfsx/ASxwTWocnY0Ejsw FaaVD+gI 3QmHW1/2GDcLsElY1Rph6RtdOl6MppIJqlaS1vvVWNj2+YYq9m7q2rsS1x6njeYHRaqml5WovKqzOGhkkAaEqzoYIC6w+j771tagErMMlRzEVzPU4HDbkZNASiiw62ZuAh8ghDtbBB9xJtgMLVKa1BmZMWGDjt81WiqXFe4qWlUDubF7NYpPp5hfftQ4RcGJSyVyl1I1K2IkZIXHXbAHzemKn80fbKQD5DGnZv0FcdDhmXnm8VZY418O8IA/oBhj55arCnODuPkdS3u5dCo/2fGXophxyoxyzQT3s9JxjVCy3V4j1K9Tc0q2u4Oqcp6RDM/1sR0KTxeiAFHfjczu5STUyCgzIuGcbBfFG9pNvPA6L1uGSMT6sEmntfg== 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 Thu 05-06-25 08:48:07, Baolin Wang wrote: > > > On 2025/6/5 00:54, Shakeel Butt wrote: > > On Wed, Jun 04, 2025 at 10:16:18PM +0800, Baolin Wang wrote: > > > > > > > > > On 2025/6/4 21:46, Vlastimil Babka wrote: > > > > On 6/4/25 14:46, Baolin Wang wrote: > > > > > > Baolin, please run stress-ng command that stresses minor anon page > > > > > > faults in multiple threads and then run multiple bash scripts which cat > > > > > > /proc/pidof(stress-ng)/status. That should be how much the stress-ng > > > > > > process is impacted by the parallel status readers versus without them. > > > > > > > > > > Sure. Thanks Shakeel. I run the stress-ng with the 'stress-ng --fault 32 > > > > > --perf -t 1m' command, while simultaneously running the following > > > > > scripts to read the /proc/pidof(stress-ng)/status for each thread. > > > > > > > > How many of those scripts? > > > > > > 1 script, but will start 32 threads to read each stress-ng thread's status > > > interface. > > > > > > > > From the following data, I did not observe any obvious impact of this > > > > > patch on the stress-ng tests when repeatedly reading the > > > > > /proc/pidof(stress-ng)/status. > > > > > > > > > > w/o patch > > > > > stress-ng: info: [6891] 3,993,235,331,584 CPU Cycles > > > > > 59.767 B/sec > > > > > stress-ng: info: [6891] 1,472,101,565,760 Instructions > > > > > 22.033 B/sec (0.369 instr. per cycle) > > > > > stress-ng: info: [6891] 36,287,456 Page Faults Total > > > > > 0.543 M/sec > > > > > stress-ng: info: [6891] 36,287,456 Page Faults Minor > > > > > 0.543 M/sec > > > > > > > > > > w/ patch > > > > > stress-ng: info: [6872] 4,018,592,975,968 CPU Cycles > > > > > 60.177 B/sec > > > > > stress-ng: info: [6872] 1,484,856,150,976 Instructions > > > > > 22.235 B/sec (0.369 instr. per cycle) > > > > > stress-ng: info: [6872] 36,547,456 Page Faults Total > > > > > 0.547 M/sec > > > > > stress-ng: info: [6872] 36,547,456 Page Faults Minor > > > > > 0.547 M/sec > > > > > > > > > > ========================= > > > > > #!/bin/bash > > > > > > > > > > # Get the PIDs of stress-ng processes > > > > > PIDS=$(pgrep stress-ng) > > > > > > > > > > # Loop through each PID and monitor /proc/[pid]/status > > > > > for PID in $PIDS; do > > > > > while true; do > > > > > cat /proc/$PID/status > > > > > usleep 100000 > > > > > > > > Hm but this limits the reading to 10 per second? If we want to simulate an > > > > adversary process, it should be without the sleeps I think? > > > > > > OK. I drop the usleep, and I still can not see obvious impact. > > > > > > w/o patch: > > > stress-ng: info: [6848] 4,399,219,085,152 CPU Cycles > > > 67.327 B/sec > > > stress-ng: info: [6848] 1,616,524,844,832 Instructions > > > 24.740 B/sec (0.367 instr. per cycle) > > > stress-ng: info: [6848] 39,529,792 Page Faults Total > > > 0.605 M/sec > > > stress-ng: info: [6848] 39,529,792 Page Faults Minor > > > 0.605 M/sec > > > > > > w/patch: > > > stress-ng: info: [2485] 4,462,440,381,856 CPU Cycles > > > 68.382 B/sec > > > stress-ng: info: [2485] 1,615,101,503,296 Instructions > > > 24.750 B/sec (0.362 instr. per cycle) > > > stress-ng: info: [2485] 39,439,232 Page Faults Total > > > 0.604 M/sec > > > stress-ng: info: [2485] 39,439,232 Page Faults Minor > > > 0.604 M/sec > > > > Is the above with 32 non-sleeping parallel reader scripts? > > Yes. Thanks, this seems much more representative. Please update the changelog with this. With that feel free to add Acked-by: Michal Hocko Thanks! -- Michal Hocko SUSE Labs