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 X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB25C433B4 for ; Thu, 22 Apr 2021 18:35:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 792FD61425 for ; Thu, 22 Apr 2021 18:35:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 792FD61425 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0055E6B0074; Thu, 22 Apr 2021 14:35:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1D166B0089; Thu, 22 Apr 2021 14:35:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D957C6B008A; Thu, 22 Apr 2021 14:35:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id BC5BF6B0074 for ; Thu, 22 Apr 2021 14:35:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6F123349B for ; Thu, 22 Apr 2021 18:35:35 +0000 (UTC) X-FDA: 78060856230.02.C52049A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf24.hostedemail.com (Postfix) with ESMTP id F39D0A0003A3 for ; Thu, 22 Apr 2021 18:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619116534; h=from:from: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; bh=Kz4vXeVMATI5AQeq6XpCZGiPxgizORCRtbXEta792G4=; b=cX13f+NGzcOadQ7wdRRqWedh/VOwCBGlCL4SENoNtkQC/PHz3ojcwE7Z19bw7Fhtm5/laB BF0kCCv2GTjt4wzMVhMcpDQuU+XvGBjfhAO0yLA+QGI6/yvd4fdOrfau3sBGW2XbtrGbUq nhxCVNo+m3ndR4deCHyW4ZAmW9U5jnU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-ms241yPGPoSyRS4TFdwYnw-1; Thu, 22 Apr 2021 14:35:30 -0400 X-MC-Unique: ms241yPGPoSyRS4TFdwYnw-1 Received: by mail-wr1-f69.google.com with SMTP id f15-20020adffccf0000b02901028c7339ccso14169031wrs.1 for ; Thu, 22 Apr 2021 11:35:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Kz4vXeVMATI5AQeq6XpCZGiPxgizORCRtbXEta792G4=; b=o1Syl/VtmlijJAzGPg4JW0hikliHqnlKsNt0rQ6IJgW5C+V0tWAIGkissO1PH1yGit FZ+/z0JxOYHAYiUEbKVS/xDM79O3NjQ9WTL6/i0eWHR/rsDcwSHYAQsiSnM+yMl4jXyg 7s1uSVPI2fFHozrY8rClFXszpdjxIKlb2xv1rH5TbDHXIz/pBjdnxATgpAeysxjKa9pE Pu/fKWLfDE04kq9lN+YaeBQl3iyIW8v7Ohykcgk7iGaJwLoegFzruW4CmJNfKtXPVck9 Ea/ovbXioA0OikY2o4ShbP7yexmf7UKLtpkC02mRQPhJHDXx0X6GVcBEAL393AfYPnfB IH0g== X-Gm-Message-State: AOAM5312kVT8lE9UTuFFYlY5SZ44URGzpKwAxqoKjklZJkyU/kEpJxIR CB9ez58l/3V0wKkiKXkRDpLWQrGquLfH3mYjxpMmeOtEj57k1X4GHSrMa+khyo9YZnzTn/aVmWs HYmwDBidAZmzBDzrEgBSfi/G7j59OEnTDSQ4cOGXHmjK96qxtBjVabhwWn4M= X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr1455036wmk.104.1619116529269; Thu, 22 Apr 2021 11:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAQZUObyiz3i0vFyBT/BBrWAuuzWOPOI6zmgVJXEKCC41h1S9PCHMY1r7uTMpOj+cwsvgJ1w== X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr1455002wmk.104.1619116528914; Thu, 22 Apr 2021 11:35:28 -0700 (PDT) Received: from [192.168.3.132] (p4ff23eb0.dip0.t-ipconnect.de. [79.242.62.176]) by smtp.gmail.com with ESMTPSA id v4sm5350524wrf.36.2021.04.22.11.35.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Apr 2021 11:35:28 -0700 (PDT) Subject: Re: alloc_contig_range() with MIGRATE_MOVABLE performance regression since 4.9 To: Florian Fainelli , Michal Hocko Cc: Vlastimil Babka , Mel Gorman , Minchan Kim , Johannes Weiner , l.stach@pengutronix.de, LKML , Jaewon Kim , Michal Nazarewicz , Joonsoo Kim , Oscar Salvador , "linux-mm@kvack.org" References: <8919b724-ce5b-a80f-bbea-98b99af97357@redhat.com> <58726a6b-5468-a6b4-7c26-371ef5d71ee2@gmail.com> From: David Hildenbrand Organization: Red Hat Message-ID: <9df905cf-cc4f-c739-26cb-c2e5c6e5a234@redhat.com> Date: Thu, 22 Apr 2021 20:35:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <58726a6b-5468-a6b4-7c26-371ef5d71ee2@gmail.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: my34ipgfdtdyy9jp6ob1ji1fhrnkob8g X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F39D0A0003A3 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619116525-529938 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 22.04.21 19:50, Florian Fainelli wrote: > > > On 4/22/2021 1:56 AM, David Hildenbrand wrote: >> On 22.04.21 09:49, Michal Hocko wrote: >>> Cc David and Oscar who are familiar with this code as well. >>> >>> On Wed 21-04-21 11:36:01, Florian Fainelli wrote: >>>> Hi all, >>>> >>>> I have been trying for the past few days to identify the source of a >>>> performance regression that we are seeing with the 5.4 kernel but not >>>> with the 4.9 kernel on ARM64. Testing something newer like 5.10 is a bit >>>> challenging at the moment but will happen eventually. >>>> >>>> What we are seeing is a ~3x increase in the time needed for >>>> alloc_contig_range() to allocate 1GB in blocks of 2MB pages. The system >>>> is idle at the time and there are no other contenders for memory other >>>> than the user-space programs already started (DHCP client, shell, etc.). >> >> Hi, >> >> If you can easily reproduce it might be worth to just try bisecting; >> that could be faster than manually poking around in the code. >> >> Also, it would be worth having a look at the state of upstream Linux. >> Upstream Linux developers tend to not care about minor performance >> regressions on oldish kernels. > > This is a big pain point here and I cannot agree more, but until we > bridge that gap, this is not exactly easy to do for me unfortunately and > neither is bisection :/ > >> >> There has been work on improving exactly the situation you are >> describing -- a "fail fast" / "no retry" mode for alloc_contig_range(). >> Maybe it tackles exactly this issue. >> >> https://lkml.kernel.org/r/20210121175502.274391-3-minchan@kernel.org >> >> Minchan is already on cc. > > This patch does not appear to be helping, in fact, I had locally applied > this patch from way back when: > > https://lkml.org/lkml/2014/5/28/113 > > which would effectively do this unconditionally. Let me see if I can > showcase this problem a x86 virtual machine operating in similar > conditions to ours. How exactly are you allocating these 2MiB blocks? Via CMA->alloc_contig_range() or via alloc_contig_range() directly? I assume via CMA. For https://lkml.kernel.org/r/20210121175502.274391-3-minchan@kernel.org to do its work you'll have to pass __GFP_NORETRY to alloc_contig_range(). This requires CMA adaptions, from where we call alloc_contig_range(). -- Thanks, David / dhildenb