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 3D54CC47090 for ; Tue, 6 Dec 2022 18:41:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0C818E0003; Tue, 6 Dec 2022 13:41:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBC2C8E0001; Tue, 6 Dec 2022 13:41:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAAFA8E0003; Tue, 6 Dec 2022 13:41:50 -0500 (EST) 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 AB96F8E0001 for ; Tue, 6 Dec 2022 13:41:50 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8C500140ACB for ; Tue, 6 Dec 2022 18:41:50 +0000 (UTC) X-FDA: 80212750380.06.B1C7702 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf08.hostedemail.com (Postfix) with ESMTP id 9E7C5160016 for ; Tue, 6 Dec 2022 18:41:48 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=ggZvjEjK; spf=pass (imf08.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670352109; 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=QGDPW0qn4xB9RA6D+u1gKg7b7l81anigG3dz/OOHF2g=; b=snhdQrAKQV6PlQaO/olrw9M3+XYQvN3bw7E8V5ycz4txI7J3b0rLDZMmegG4w220jyQXhR pMcjgxwXeAbFe7T4RNrqzQexL7sNXYfw/r9D23NofcwXwyEESpL1rpWE+gc5lFStr+ZUJc J62cHi5e7uzD3tcgPSVuVB0zZZC+O3k= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=ggZvjEjK; spf=pass (imf08.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670352109; a=rsa-sha256; cv=none; b=UtjZFycAl7nO6mFQtptYpHluujYdrjf+MNevQ/0GaWTYIUhpvajB8nn5WA1FeobArrrAui o6xgN4443YPdBbvIZLeO2RMLF1UzwA2ZpxIbWESxHBkpyC0nfJ1T9sV4FDIIpFlFzGvhHM toDTXrDEXd+nkFOXpU3bdFP4BROCKBc= Received: by mail-qk1-f173.google.com with SMTP id z17so8207568qki.11 for ; Tue, 06 Dec 2022 10:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QGDPW0qn4xB9RA6D+u1gKg7b7l81anigG3dz/OOHF2g=; b=ggZvjEjKQi2R/wjjDPkKFioUFaKFXL1nm0gNlGGrjxzXjM3owIUwa2ij8Vhl9diYzx D7BAn7xwRq50qfTkx29PHUUGQf1gfyQr1++AUM8iGhQQlI7XzulOgG/4PccQmO2nm2nv TNyj+WUxy6Ol6xF7Ho6aULUaihzU2JaZdd+us= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QGDPW0qn4xB9RA6D+u1gKg7b7l81anigG3dz/OOHF2g=; b=UK/FgNSXWfO4rn1dQjHqTIgiU54T2RT/qfkn6rTIeYi7QVFT5plB4f80klRybZHo5C 181chySMeHcx230+GPhrqxQ7c9bhybqi+ozm2WHKMPOV1hgJieEcBwVsRTwWdVmLubhZ SWgmMgdrzJ4Yftck5TDtRcfnxVNKp9G+eKmFDsuLU5Xfqe132BWXALsFB43DPMwSPm9l LC99qbUwa/rCWFA58AKbdBR8v6bciZdvLqUcovIgyhlYUytCuzwdEnd0xo9jXZxl3KIn j42G0Q10TWrepfTx8CFZMoXvCvSe1VX1d2883AbyQran0sZ6D+oK4h/gc7LWWTjEAd/2 ZSZw== X-Gm-Message-State: ANoB5pmjdnHmxCOnM21aPhIPDBGlt2G8p86bkskFMHW6m5GKPK0Xx3kd QOoWCr3+/rycbbmN7uzsRwh2WmAZAyrM2Haq X-Google-Smtp-Source: AA0mqf68B6ccHiqmoWJYzsFGgke7ovmAjJBYZIP4CKhn2oddrNgbrNou0U3bZsxJ1WfI54UL1dCVOQ== X-Received: by 2002:a05:620a:4902:b0:6fa:3867:323b with SMTP id ed2-20020a05620a490200b006fa3867323bmr58983307qkb.369.1670352107434; Tue, 06 Dec 2022 10:41:47 -0800 (PST) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com. [209.85.222.170]) by smtp.gmail.com with ESMTPSA id k26-20020ac8605a000000b0035d08c1da35sm11878442qtm.45.2022.12.06.10.41.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Dec 2022 10:41:45 -0800 (PST) Received: by mail-qk1-f170.google.com with SMTP id x24so7554691qkf.5 for ; Tue, 06 Dec 2022 10:41:45 -0800 (PST) X-Received: by 2002:ae9:e00c:0:b0:6f8:1e47:8422 with SMTP id m12-20020ae9e00c000000b006f81e478422mr78525658qkk.72.1670352104706; Tue, 06 Dec 2022 10:41:44 -0800 (PST) MIME-Version: 1.0 References: <202212051534.852804af-yujie.liu@intel.com> <87ilipffws.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: <87ilipffws.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Linus Torvalds Date: Tue, 6 Dec 2022 10:41:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linux-next:master] [mm] 5df397dec7: will-it-scale.per_thread_ops -53.3% regression To: "Huang, Ying" Cc: kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, Andrew Morton , Johannes Weiner , Hugh Dickins , Nadav Amit , Linux Memory Management List , linux-arch@vger.kernel.org, feng.tang@intel.com, zhengjun.xing@linux.intel.com, fengwei.yin@intel.com Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [8.90 / 9.00]; SORBS_IRL_BL(6.00)[209.85.222.170:received,209.85.222.173:from]; SUSPICIOUS_RECIPS(1.50)[]; SUBJECT_HAS_UNDERSCORES(1.00)[]; FORGED_SENDER(0.30)[torvalds@linux-foundation.org,torvalds@linuxfoundation.org]; BAD_REP_POLICIES(0.10)[]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.00)[22.90%]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[13]; DKIM_TRACE(0.00)[linux-foundation.org:+]; R_DKIM_ALLOW(0.00)[linux-foundation.org:s=google]; FROM_NEQ_ENVFROM(0.00)[torvalds@linux-foundation.org,torvalds@linuxfoundation.org]; MIME_TRACE(0.00)[0:+]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[linux-mm@kvack.org]; TAGGED_RCPT(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[linux-foundation.org]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9E7C5160016 X-Stat-Signature: ckf1yg6c1sd9izygds91w47c1gb9s64e X-HE-Tag: 1670352108-32582 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 Mon, Dec 5, 2022 at 6:03 PM Huang, Ying wrote: > > > > > I assume that this test is doing a lot of mmap/munmap on dirty shared > > memory regions (both because of the regression, and because of the > > name of that test ;) > > I have checked the source code of will-it-scale/page_fault3. Yes, it > exactly does that. Heh. I took a look at that test-case, and yeah, it's just doing a 128MB shared mapping, dirtying it one page at a time, and unmapping it in a loop. It doesn't even look like a very good benchmark for that, because the _first_ time around the loop it does it is very different in that it has to actually create the file extents. So that benchmark starts out testing something different than what the steady state is. But yeah, that's pretty much the worst possible case for this all, and yes, I suspect it's more about the TLB batching than anything else. And I think I see the issue. We actually have a reasonably big batch size most of the time, but this benchmark triggers that dirty shared page logic on every page, and that in turn means that we stop batching immediately - even when we only have the initial tiny on-stack batch. So instead of batching MAX_GATHER_BATCH pages at a time (roughly 500 pages per go), we end up batching just eight pages (MMU_GATHER_BUNDLE) at a time. I didn't think of that degenerate case. Let me think about this a while, but I think I'll have a patch for you to test once I've dealt with a couple more pull requests. Linus