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=-5.4 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 88988C2D0A3 for ; Thu, 12 Nov 2020 16:09:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C8DF22227 for ; Thu, 12 Nov 2020 16:09:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QeIcTAQB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C8DF22227 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 4004F6B0068; Thu, 12 Nov 2020 11:09:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AF086B0073; Thu, 12 Nov 2020 11:09:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C5716B0074; Thu, 12 Nov 2020 11:09:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id F25186B0068 for ; Thu, 12 Nov 2020 11:09:19 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9692F1EE6 for ; Thu, 12 Nov 2020 16:09:19 +0000 (UTC) X-FDA: 77476250838.03.coast14_3012c6b27307 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 749F328A4EA for ; Thu, 12 Nov 2020 16:09:19 +0000 (UTC) X-HE-Tag: coast14_3012c6b27307 X-Filterd-Recvd-Size: 5725 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 16:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605197358; 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=QeIcTAQB/O2HeDLpq3grZlbTCIdgLVyS4NmIq2fxsj70RcsITk7VvZOMm/1iMrpCcmxC7B keLAJsT+gQ7e664VwjZJNHVwtSVbfznuWGTtHR/wO2dXk3DJsOH68LVq2IzMIjMPArcR+J 74Doabr5KS4m2XfHSmwP/rLUA6BUeg8= 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 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 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