Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp240501pxj; Fri, 28 May 2021 02:54:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBQWQGGF+CfevxnGBQP9ygh06l+7l7jZXgSEOG8/+2rrs487zA6/Rquo7/78p3EifyatLb X-Received: by 2002:a5e:a704:: with SMTP id b4mr6656182iod.35.1622195643812; Fri, 28 May 2021 02:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622195643; cv=none; d=google.com; s=arc-20160816; b=ooKBqDVASJpNeUFWNuLJQCOR8y8bhPFmGeSW7Zsz18/urNiJaFCwYXwH/3I1TTJnKk Yx+N6CW1tJqFkEXg/BdZs+6ICBItfOlwwWcsEU/3lO0iWVScGBJSWQRPDy85w9JbAk1v G6j01By5DPprYzSViSlvnekMqx9HXoCq+ZGqCbQWFEQN5caXr/inur4MMgNbK1Vpugzm U51XJ2waq59YsgRcj54fs8Q7JYhUXYL4XNjQIJnnBk0HbJCJYiiFuYcDdpyN8TVQfqPK itBvwl5xGGAuXAZQSfLZ4afPgmq4HyRs9B9l/LCkkxGftaHlM66BqidmIbgbsnyorCZ9 eHxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=nsLO7oE7ppzKwDyWlT5ZZ5W2YnsqsWgEvpJ/TDeViTw=; b=DSuftEcSfuWs1FFEM4Ap+TjsnMwmVhO3wjokt25MuBKrBaDR4z8B7eHLnmktxwdd/n OK7iiAWE9Dy5usScvBnwffmijRBDCGaiDvnNQyCXJNC9oJV5MJabMz56CbXYXi8DEZN2 h3gCVxx5qRtCLuou0W2sLne0w+88sxv2cC+lJj1HYmpWhH9m+F4DEawmg63+0O4hR6Xr Q3I3XUVoCVYO1Uq2YYA8QFrW41zteUJ5o0+RoxA2dokNhPEEefM6r4qr7B/u/k4XMZWz bfQ87nfuouVk8wTpWGUJEVL1HMTnLKis/5gxpJvZU0TZxNn/iFmwdjIcHFrJ0tHU6L8r ETvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XdPGe3pl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si5167703ilc.73.2021.05.28.02.53.49; Fri, 28 May 2021 02:54:03 -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=@redhat.com header.s=mimecast20190719 header.b=XdPGe3pl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235106AbhE1Jyk (ORCPT + 99 others); Fri, 28 May 2021 05:54:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23938 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234926AbhE1Jyg (ORCPT ); Fri, 28 May 2021 05:54:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622195581; 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=nsLO7oE7ppzKwDyWlT5ZZ5W2YnsqsWgEvpJ/TDeViTw=; b=XdPGe3pltsNwZc/TCmjMQc3ZaIakei7UQGNqiohwvUcuJoXkAs2EQgGjteqXguCOZLdvWa tcdWHVtU0o+mHSGUREVx2gW5kgQrHz65cpkSXole8ap3zBljXQrDKuoXOLMv1Iu8u66NAf 9jwRptGr9IdFa0zr/jHI8mNIvecY0zM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-555-EkW52LtdNg2gE3RGojgbKQ-1; Fri, 28 May 2021 05:52:55 -0400 X-MC-Unique: EkW52LtdNg2gE3RGojgbKQ-1 Received: by mail-wm1-f69.google.com with SMTP id v2-20020a7bcb420000b0290146b609814dso975780wmj.0 for ; Fri, 28 May 2021 02:52:55 -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=nsLO7oE7ppzKwDyWlT5ZZ5W2YnsqsWgEvpJ/TDeViTw=; b=pDscDc1CYd5c8ZTWcdqjgn1MEqyDVkSbWzczjfGeWGNJKvPTS6JGUBZ3v+eZsXJdAF 15m7QzPyjFJBmLueWO/PgY9d7UfRfR3Ss+TotPFJ7GnkI6TKcDyh9asan6vhWFS08GeX 1qESRH5MUXpI9cHpKVk/K2nDl+Kg4rF/CJvtnGv9CertyvmwWROEv5hNfmmRAZQj9M9Y eMhQeKG6Ar7qV+9bPnZjqzI17rDpy8o9CQmAtSz62MdpPlJGNtOI5JRKc3pYg9iCocCv 6f8EmmO5lA3KMWHGXxDlkFp9nX9fd+GvcIHlPo06B4lo0/gRtwRbitQ2Yt5VALz1o4yO zfxA== X-Gm-Message-State: AOAM533YWHU870WKc0sTu6cpMS1bd+14oCO/4uF2fMevrw9i/M/ORq/n ZHFY5cjRUccjuklzrZ6ngSaIpqUFWQlj6EiG5XZSZvZJ4yg0RpR1F8EB2Ai1Xff9R/Q9Q+DDT8m KqILiupQvUhKHIjf/As5fpKpp X-Received: by 2002:a5d:678d:: with SMTP id v13mr7837036wru.83.1622195574371; Fri, 28 May 2021 02:52:54 -0700 (PDT) X-Received: by 2002:a5d:678d:: with SMTP id v13mr7837021wru.83.1622195574175; Fri, 28 May 2021 02:52:54 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6870.dip0.t-ipconnect.de. [91.12.104.112]) by smtp.gmail.com with ESMTPSA id y22sm15948776wma.36.2021.05.28.02.52.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 May 2021 02:52:53 -0700 (PDT) Subject: Re: [PATCH 0/6 v2] Calculate pcp->high based on zone sizes and active CPUs To: Mel Gorman Cc: Dave Hansen , Andrew Morton , Hillf Danton , Dave Hansen , Vlastimil Babka , Michal Hocko , LKML , Linux-MM , "Tang, Feng" References: <20210525080119.5455-1-mgorman@techsingularity.net> <7177f59b-dc05-daff-7dc6-5815b539a790@intel.com> <20210528085545.GJ30378@techsingularity.net> <54ff0363-2f39-71d1-e26c-962c3fddedae@redhat.com> <20210528094949.GL30378@techsingularity.net> From: David Hildenbrand Organization: Red Hat Message-ID: <6c189def-11cc-80db-0fde-56aa506cfdea@redhat.com> Date: Fri, 28 May 2021 11:52:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210528094949.GL30378@techsingularity.net> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28.05.21 11:49, Mel Gorman wrote: > On Fri, May 28, 2021 at 11:08:01AM +0200, David Hildenbrand wrote: >> On 28.05.21 11:03, David Hildenbrand wrote: >>> On 28.05.21 10:55, Mel Gorman wrote: >>>> On Thu, May 27, 2021 at 12:36:21PM -0700, Dave Hansen wrote: >>>>> Hi Mel, >>>>> >>>>> Feng Tang tossed these on a "Cascade Lake" system with 96 threads and >>>>> ~512G of persistent memory and 128G of DRAM. The PMEM is in "volatile >>>>> use" mode and being managed via the buddy just like the normal RAM. >>>>> >>>>> The PMEM zones are big ones: >>>>> >>>>> present 65011712 = 248 G >>>>> high 134595 = 525 M >>>>> >>>>> The PMEM nodes, of course, don't have any CPUs in them. >>>>> >>>>> With your series, the pcp->high value per-cpu is 69584 pages or about >>>>> 270MB per CPU. Scaled up by the 96 CPU threads, that's ~26GB of >>>>> worst-case memory in the pcps per zone, or roughly 10% of the size of >>>>> the zone. >>> >>> When I read about having such big amounts of free memory theoretically >>> stuck in PCP lists, I guess we really want to start draining the PCP in >>> alloc_contig_range(), just as we do with memory hotunplug when offlining. >>> >> >> Correction: we already drain the pcp, we just don't temporarily disable it, >> so a race as described in offline_pages() could apply: >> >> "Disable pcplists so that page isolation cannot race with freeing >> in a way that pages from isolated pageblock are left on pcplists." >> >> Guess we'd then want to move the draining before start_isolate_page_range() >> in alloc_contig_range(). >> > > Or instead of draining, validate the PFN range in alloc_contig_range > is within the same zone and if so, call zone_pcp_disable() before > start_isolate_page_range and enable after __alloc_contig_migrate_range. > We require the caller to only pass a range within a single zone, so that should be fine. The only ugly thing about zone_pcp_disable() is mutex_lock(&pcp_batch_high_lock) which would serialize all alloc_contig_range() and even with offline_pages(). -- Thanks, David / dhildenb