Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp580967pxb; Thu, 12 Nov 2020 10:50:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxj6+gx4CVfI4fxzw0FNZsKhJNYpY2PFiDm1pU1k8NtOqws1FNuISYmnL+kdZLl3LygVa2/ X-Received: by 2002:a17:906:e53:: with SMTP id q19mr744467eji.254.1605207036794; Thu, 12 Nov 2020 10:50:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605207036; cv=none; d=google.com; s=arc-20160816; b=F98Dz4gIsz6UcEyom0dumAgGixFwgNnmU6gE52toknLxpqUpdLnvqDh5gAl7M2Sgv9 QXoWufKjR3H0OoFzaldizwacOP/1gUY7z+43FB5sA3MfTznkNwI56iXmNWQqO+ldCp0Q N2GFd5LMbnifBkY8wfe8eAzIEK5Vd5GjacBrm+z+h8rccEZSuuM6sOlfOxiXg/b8fGSb 4HctaxeNau2aW7JvRaAgS9/Z03F/3aZDZCFCjLIFDnts0kvNnMsfQPzvEqYruPFKDjOt E5/D+qt+/rmlLBi4ZzzashPLPCNjE1Uho1YY2UccsoLaBkhWLbJiH/MWQKfaMgSLmtAo blQQ== 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=2jKkxUNBVBuz7hz3sv4q6pZ/I/3BwEfzsjfdJ4qFdKk=; b=lsZ+Eo4n+q7O4svRWr0LQdFb+4pvmw2AYqAhCPZPcQ6Rb06M/AjGCOTzvpKHRrJiNp J7oQSqIjOH+ilFcNaZanjFiLiUJJBtLWNGK3uikbCKSENxrctrBVzA+5U3LM6BMqGuus w6ktq664GsgGCkzCfkvaw9QwDe9jjNRg+4Ae4kYBC58K2oizpQjAD/G612LpFoj0a3TI dqDAvx4qDGNsffg4kFQh48KICA0qrC76gBdxWYQzhd7l4KGl9iyFmUrHTgT2putW2LoT GcsQrA6SVTp5DDP3sx5NTs+ueqD33PBu2mVjm5M4D0CXL/IP9kyCYmmsUzVZGzn4jwda tS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NwxzmoHE; 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 lf3si4261056ejb.78.2020.11.12.10.49.52; Thu, 12 Nov 2020 10:50:36 -0800 (PST) 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=NwxzmoHE; 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 S1728598AbgKLQJ0 (ORCPT + 99 others); Thu, 12 Nov 2020 11:09:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43690 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728599AbgKLQJV (ORCPT ); Thu, 12 Nov 2020 11:09:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605197360; 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=2jKkxUNBVBuz7hz3sv4q6pZ/I/3BwEfzsjfdJ4qFdKk=; b=NwxzmoHEb3ir6gzLaVTZl1B0kT9Q3XQSNCbmaZzJinbZ4Krvy4XR0I6IBjLTBWxGfcE1ST fTzPcmtBYBUFM0L4HWnnT5i6SNLK34qozfLkk2O2snqYol7apdxltMdWgAhD8yzy7lvOSc wrwQA9y3va6Hjtq5kIyEksUVk7RE0Ak= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-yBHZQpSQM8yPvpsCQKSibg-1; Thu, 12 Nov 2020 11:09:16 -0500 X-MC-Unique: yBHZQpSQM8yPvpsCQKSibg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33151D8EEB; Thu, 12 Nov 2020 16:09:10 +0000 (UTC) Received: from [10.36.115.61] (ovpn-115-61.ams2.redhat.com [10.36.115.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A7C755778; Thu, 12 Nov 2020 16:09:07 +0000 (UTC) Subject: Re: [PATCH v3 7/7] mm, page_alloc: disable pcplists during memory offline To: Vlastimil Babka , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko , Pavel Tatashin , Oscar Salvador , Joonsoo Kim , Michal Hocko References: <20201111092812.11329-1-vbabka@suse.cz> <20201111092812.11329-8-vbabka@suse.cz> <6fdaaeeb-154b-5de1-3008-e56a8be53a5a@redhat.com> <527480ef-ed72-e1c1-52a0-1c5b0113df45@suse.cz> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <36fbd86a-dd1b-70eb-9372-7523b65d1e72@redhat.com> Date: Thu, 12 Nov 2020 17:09:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <527480ef-ed72-e1c1-52a0-1c5b0113df45@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.11.20 16:18, Vlastimil Babka wrote: > On 11/11/20 6:58 PM, David Hildenbrand wrote: >> On 11.11.20 10:28, Vlastimil Babka wrote: >>> - /* >>> - * per-cpu pages are drained after start_isolate_page_range, but >>> - * if there are still pages that are not free, make sure that we >>> - * drain again, because when we isolated range we might have >>> - * raced with another thread that was adding pages to pcp list. >>> - * >>> - * Forward progress should be still guaranteed because >>> - * pages on the pcp list can only belong to MOVABLE_ZONE >>> - * because has_unmovable_pages explicitly checks for >>> - * PageBuddy on freed pages on other zones. >>> - */ >>> ret = test_pages_isolated(start_pfn, end_pfn, MEMORY_OFFLINE); >>> - if (ret) >>> - drain_all_pages(zone); >>> + >> >> Why two empty lines before the "} while (ret);" ? (unless I'm confused >> while looking at this diff) >> > > No there's just a single emply line after "ret = test_pages_isolated..." > Before there was none, which looked ok with the extra identation of the > now-removed "drain_all_pages(zone);" > >>> +void __zone_set_pageset_high_and_batch(struct zone *zone, unsigned long high, >>> + unsigned long batch) >>> +{ >>> + struct per_cpu_pageset *p; >>> + int cpu; >>> + >>> + for_each_possible_cpu(cpu) { >>> + p = per_cpu_ptr(zone->pageset, cpu); >>> + pageset_update(&p->pcp, high, batch); >>> + } >>> +} >>> + >>> /* >>> * Calculate and set new high and batch values for all per-cpu pagesets of a >>> * zone, based on the zone's size and the percpu_pagelist_fraction sysctl. >>> @@ -6315,8 +6338,6 @@ static void pageset_init(struct per_cpu_pageset *p) >>> static void zone_set_pageset_high_and_batch(struct zone *zone) >>> { >>> unsigned long new_high, new_batch; >>> - struct per_cpu_pageset *p; >>> - int cpu; >>> >>> if (percpu_pagelist_fraction) { >>> new_high = zone_managed_pages(zone) / percpu_pagelist_fraction; >>> @@ -6336,10 +6357,7 @@ static void zone_set_pageset_high_and_batch(struct zone *zone) >>> zone->pageset_high = new_high; >>> zone->pageset_batch = new_batch; >>> >>> - for_each_possible_cpu(cpu) { >>> - p = per_cpu_ptr(zone->pageset, cpu); >>> - pageset_update(&p->pcp, new_high, new_batch); >>> - } >>> + __zone_set_pageset_high_and_batch(zone, new_high, new_batch); >>> } >> >> These two hunks look like an unrelated cleanup, or am I missing something? > > It's extracting part of functionality to __zone_set_pageset_high_and_batch() > that's now called also from zone_pcp_enable() and zone_pcp_disable() - to only > adjust the per-cpu zone->pageset values without the usual calculation. > >> Thanks for looking into this! > > Thanks for review. Here's updated version that adds more detailed comment about > force_all_cpus parameter to __drain_all_pages() header, hopefully that clarifies > your concerns. LGTM! Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb