Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3834556pxf; Mon, 15 Mar 2021 21:41:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs/jhNhs091VXgZ6BZRv3FT9KczdT4XEFR5/XTo6SPFMGOZWrNpPvfZz+FL04Y+U4J9fPF X-Received: by 2002:a17:906:78d:: with SMTP id l13mr26518503ejc.97.1615869674662; Mon, 15 Mar 2021 21:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615869674; cv=none; d=google.com; s=arc-20160816; b=vIE43/OTFuTfDAADXpIoeeFG1RnzFJXeCLhpKMg2FK4ie9sh20IM7SBIFlfYPZfExZ whcdpoPXhkqfmNKOBKur8dXCQzLrRtgzYVGUfuk7hQuQ7ymkQiJw54R8eSSmowaRAcIk Yr5XaCOxQHJFAZVvVCaotAR/afBF/ca9wAt1EvwTu7UY0oRkQC16TbuANRtsgcXZfyqE tCQDKRfLjFqNUWcZC2I139Nyqh08z7bn4jbl3djn61wKYULhJrV8SIjQCMgsg4xbtN+C ldml8ufFrPmKJm8aqLEGiwu8pHxxHnYVhWTZyWICTfbmoI0bIeMIJHcjXbqXtGYXytXs y/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XC8bY/c6LlHvD9TH9UevY57CN7cJD6ZiGwwB++TkJO4=; b=hFT760JQbuUyl6oOSjG9YRDkLRhF5PP9gqEv/HLdRINCigueyL6jhUM9/Y+U8LRMDu oV6cocs7okVur7cpsl8vDipCv90FF7P8zU7Gth4irEgx81xj/s8pMyw+nG7jao3gIXo6 5B0ADhxVLndPCPy2mnmi5iOikYeRgK8+8fuiRQj/fjRL1eGfu9rDYUKuu3LkiSfIgOWs f1nSXJhw94Z+yb3dxoyQcWb4mxME8ai12U8ZCpdA8GHig1LV+cjl2QzW6TDaOyj726Y6 PqRJf3EQf8y/yMaOqLcJzYwq/LqanfLwpHVSsELR/yKDglRDr3xSH21Pn5bvAu+7o0M7 +Zdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eFzH9DHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si12550545edc.194.2021.03.15.21.40.52; Mon, 15 Mar 2021 21:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eFzH9DHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbhCOUnl (ORCPT + 99 others); Mon, 15 Mar 2021 16:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbhCOUnK (ORCPT ); Mon, 15 Mar 2021 16:43:10 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEBAFC06174A for ; Mon, 15 Mar 2021 13:43:09 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id e7so59062924lft.2 for ; Mon, 15 Mar 2021 13:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XC8bY/c6LlHvD9TH9UevY57CN7cJD6ZiGwwB++TkJO4=; b=eFzH9DHywvAGTJGl198bwljRgMQFqNDykZUJG+UuyF83Q9df2rYSrU3dKMNZl7Z4j/ 17/8qsalGdf/AYWeLR7MS54AUyiv+ShaAFq7tTDGqC0cp9F63qYNqNgCMEIgBMxyFeZ5 XCkj5+csYUiGPv1zdQvRdDlwTB8A74Ak2pwww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XC8bY/c6LlHvD9TH9UevY57CN7cJD6ZiGwwB++TkJO4=; b=ElCiCZdMgN4X6+FGMJyd9a7/dMfsowye8kNMLFRgwpXSMZsg/ZSQ3Dcj31AFMRiJe9 5jGdBG4/FA9Cy7Zo4Sii61V/1NO198b12quFpOyr5P5ZXsOzXboOb6PsfV/x1R6a3uJ+ uj5pjlJBOZLnRfp8ryFhwL0tBfZAcZzsGJaHTlRx46SHnbe0d0Vjha+NFj8jCNP4Zynb Awdp/jB5YjSyJW8NPgNpF87M9h0XRql1ixjPTNhh/cr/SmlEGtREcu5r53tulcGOE1zk gwsY4wSW/k9UZZrlpmUYhBh7qPCKwItk9vwtnbEw7/jfCqB0RmHISIjKuv3yJpruE1ff 8wFg== X-Gm-Message-State: AOAM533u2pY0QRAuocs2RYynnpv79J78p8bcDRnGJGEr+2y7svL6zQN4 qlEZn7uYBaMHJbWjZlKEgWxvWetE71lqTw== X-Received: by 2002:a19:7e45:: with SMTP id z66mr9000635lfc.612.1615840987864; Mon, 15 Mar 2021 13:43:07 -0700 (PDT) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id x19sm2766765lfr.198.2021.03.15.13.43.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Mar 2021 13:43:07 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id p21so58912581lfu.11 for ; Mon, 15 Mar 2021 13:43:06 -0700 (PDT) X-Received: by 2002:a05:6512:a8c:: with SMTP id m12mr9067488lfu.253.1615840986403; Mon, 15 Mar 2021 13:43:06 -0700 (PDT) MIME-Version: 1.0 References: <20210315062808.GA837@xsang-OptiPlex-9020> In-Reply-To: <20210315062808.GA837@xsang-OptiPlex-9020> From: Linus Torvalds Date: Mon, 15 Mar 2021 13:42:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [mm] f3344adf38: fxmark.hdd_btrfs_DWAL_63_bufferedio.works/sec -52.4% regression To: kernel test robot Cc: Muchun Song , Shakeel Butt , Johannes Weiner , Michal Hocko , Vladimir Davydov , Roman Gushchin , Stephen Rothwell , Chris Down , Yafang Shao , Wei Yang , Andrew Morton , LKML , lkp@lists.01.org, kernel test robot , "Huang, Ying" , Feng Tang , zhengjun.xing@intel.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 14, 2021 at 11:30 PM kernel test robot wrote: > > FYI, we noticed a -52.4% regression of fxmark.hdd_btrfs_DWAL_63_bufferedio.works/sec That's quite the huge regression. But: > due to commit: f3344adf38bd ("mm: memcontrol: optimize per-lruvec stats counter memory usage") That's _literally_ just changing a dynamically allocated per-cpu array of "long[]" to an array of "s32[]" and in the process shrinking it from 304 bytes to 152 bytes. > in testcase: fxmark > on test machine: 288 threads Intel(R) Xeon Phi(TM) CPU 7295 @ 1.50GHz with 80G memory I think this must be some really random memory layout issue that causes some false sharing or similar. And it's not even that some fundamental data structure gets a different layout, it literally is just either: (a) the (now smaller) array is allocated from a differently chunk, and that then causes random cache effects with something else (b) the (old, and bigger) array was more spread out, and as a result had different fields in different cachelines and less false sharing Normally I'd say that (b) is the obvious case, except for the fact that this is a __percpu array. So in the common case there shouldn't be any cache contention _within_ the array itself. Any cache contention should be with something else very hot that the change now randomly makes be in the same cache way or whatever. Afaik, only the flushing of the vmstats batches does access the percpu arrays from other CPUs, so (b) is not _entirely_ impossible if memcg_flush_percpu_vmstats() were to be very very very hot. But the profile data doesn't show anything remotely like that. In fact, the actual report seems to show things improving, ie things like elapsed time going down: > 1361 -9.5% 1232 fxmark.time.elapsed_time > 1361 -9.5% 1232 fxmark.time.elapsed_time.max > 25.67 +9.1% 28.00 fxmark.time.percent_of_cpu_this_job_got > 343.68 -2.0% 336.76 fxmark.time.system_time > 23.66 +2.5 26.12 mpstat.cpu.all.sys% but I don't know what the benchmark actually does, so maybe it just repeats things until it hits a certain confidence interval, and thus "elapsed time" is immaterial. Honestly, normally if I were to get a report about "52% regression" for a commit that is supposed to optimize something, I'd just revert the commit as a case of "ok, that optimization clearly didn't work". But there is absolutely no sign that this commit is actually the culprit, or explanation for why that should be, and what could be going on. So I'm going to treat this as a "bisection failure, possibly due to random code or data layout changes". Particularly since this seems to be a 4-socket Xeon Phi machine, which I think is likely a very very fragile system if there is some odd cache layout issue. If somebody can actually figure out what happened there, that would be good, but for now it goes into my "archived as a random outlier" folder. Linus