Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1809966ybl; Thu, 15 Aug 2019 01:26:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaO9WBd3VeUnMXI827XAP69dtxQpHlzXUsjekn3GobiTsLOdxPhXBWpv7kO5EX16WxM5y/ X-Received: by 2002:a17:90a:6d43:: with SMTP id z61mr1220909pjj.32.1565857566257; Thu, 15 Aug 2019 01:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565857566; cv=none; d=google.com; s=arc-20160816; b=C75huHbvUHryU+JaU3lC9LDAC7JnLcbDXVnKh3DOJMQapbEGzMU1k3+rFB01DpJ8sZ v4gLnOC/DzdI7CRbmbsWieG9l1mE/ZYx1ZJe2el91h80OviCLLOTNmSScAJQIwc7QRNh TAZnU79+4pxSp9fEt3KjLNYEwSb29/DY5qe+cr9eauv4CseaHblylEwq33eUtiFtGTdm Cj1/2GNDj2Cc0e/HoqvtSDpGFlpwsOlOK6rFfoQoeXj17U7QTBSFx7ojwD+znV2KPKd6 xLnRFmpqRzMZMhnGjHEfRM8HoGISt+ZC6OzTIr3C0Ixlw606FU3ilPOxcT4wCa7Cddyn 87fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=mmIOgbK+JKM5jqW9/BcwHJtcKEwnCjuq52vwowq/M/k=; b=mRI5BLUJAQq4zWW/PwaCwsZzVxXsVV+DsWsTKtsm6uPW0Gmhp9dZ9Oj30uMmAvZkC/ X3spau3cj5lbbVfzpdyJUucXMZjluyzEmHbA9SbaYHzKeLzWJ6zM6mq4ro1FqRcttbWF mbuEEuDH66YtgvFKsFq4g4DBgatyfmI5xQXcwR1AczE0Das/eT0JoA63lbRuVj8anaMl 054QmisJYvtbTCeBD6qnElKpf/MAtn6rUzh5fi+5wQj/kL4++qJ+VSOlBlYnyU+lV855 /bhhMocE60YSJbHNp2cC3FdFm1ui1HexfZpqPbA3KpdivulG0GCprWTlYMhFJDjg1mu8 x+rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=t7BLZTw6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay19si576581pjb.44.2019.08.15.01.25.50; Thu, 15 Aug 2019 01:26:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=t7BLZTw6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730252AbfHOHgW (ORCPT + 99 others); Thu, 15 Aug 2019 03:36:22 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:35367 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729907AbfHOHgW (ORCPT ); Thu, 15 Aug 2019 03:36:22 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 468JD30rcTz9tyg8; Thu, 15 Aug 2019 09:36:19 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=t7BLZTw6; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id HIJrNzoNiyNv; Thu, 15 Aug 2019 09:36:19 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 468JD26cH8z9tyg7; Thu, 15 Aug 2019 09:36:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1565854578; bh=mmIOgbK+JKM5jqW9/BcwHJtcKEwnCjuq52vwowq/M/k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=t7BLZTw6TKXeDRRYgbMR6vS0jqTejMQ0wIwScx/uyvfr8pfdY6az2/5oTQi+z4+ZE CpSYrQoZQBUgOU/dnXo/sdKOxHQSLtzmXCitW+lv81+sK/RC80tDwgXcaHPxmb8iLJ g3MRjTITtwC/83OVnsCL+nos7wM2M0at4qyt6Ssw= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 09DCF8B782; Thu, 15 Aug 2019 09:36:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0xetyh4uG_O4; Thu, 15 Aug 2019 09:36:19 +0200 (CEST) Received: from [192.168.232.53] (unknown [192.168.232.53]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 359E18B755; Thu, 15 Aug 2019 09:36:19 +0200 (CEST) Subject: Re: [PATCH 4/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory To: Alastair D'Silva , alastair@d-silva.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Qian Cai , Allison Randal , Thomas Gleixner , Nicholas Piggin , Greg Kroah-Hartman , Andrew Morton , Mike Rapoport , David Hildenbrand , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20190815041057.13627-1-alastair@au1.ibm.com> <20190815041057.13627-5-alastair@au1.ibm.com> From: christophe leroy Message-ID: <366f94bd-c61b-d454-b202-d3feb81a14c3@c-s.fr> Date: Thu, 15 Aug 2019 09:36:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190815041057.13627-5-alastair@au1.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 190814-8, 14/08/2019), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 15/08/2019 à 06:10, Alastair D'Silva a écrit : > From: Alastair D'Silva > > When presented with large amounts of memory being hotplugged > (in my test case, ~890GB), the call to flush_dcache_range takes > a while (~50 seconds), triggering RCU stalls. > > This patch breaks up the call into 16GB chunks, calling > cond_resched() inbetween to allow the scheduler to run. Is 16GB small enough ? If 890GB takes 50s, 16GB still takes about 1s. I'd use 1GB chuncks to remain below 100ms. > > Signed-off-by: Alastair D'Silva > --- > arch/powerpc/mm/mem.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c > index 5400da87a804..fb0d5e9aa11b 100644 > --- a/arch/powerpc/mm/mem.c > +++ b/arch/powerpc/mm/mem.c > @@ -104,11 +104,14 @@ int __weak remove_section_mapping(unsigned long start, unsigned long end) > return -ENODEV; > } > > +#define FLUSH_CHUNK_SIZE (16ull * 1024ull * 1024ull * 1024ull) Can we use SZ_16GB ? > + > int __ref arch_add_memory(int nid, u64 start, u64 size, > struct mhp_restrictions *restrictions) > { > unsigned long start_pfn = start >> PAGE_SHIFT; > unsigned long nr_pages = size >> PAGE_SHIFT; > + unsigned long i; > int rc; > > resize_hpt_for_hotplug(memblock_phys_mem_size()); > @@ -120,7 +123,11 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, > start, start + size, rc); > return -EFAULT; > } > - flush_dcache_range(start, start + size); > + > + for (i = 0; i < size; i += FLUSH_CHUNK_SIZE) { > + flush_dcache_range(start + i, min(start + size, start + i + FLUSH_CHUNK_SIZE)); Isn't the line a bit long (I have not checked). > + cond_resched(); > + } > > return __add_pages(nid, start_pfn, nr_pages, restrictions); > } > @@ -131,13 +138,18 @@ void __ref arch_remove_memory(int nid, u64 start, u64 size, > unsigned long start_pfn = start >> PAGE_SHIFT; > unsigned long nr_pages = size >> PAGE_SHIFT; > struct page *page = pfn_to_page(start_pfn) + vmem_altmap_offset(altmap); > + unsigned long i; > int ret; > > __remove_pages(page_zone(page), start_pfn, nr_pages, altmap); > > /* Remove htab bolted mappings for this section of memory */ > start = (unsigned long)__va(start); > - flush_dcache_range(start, start + size); > + for (i = 0; i < size; i += FLUSH_CHUNK_SIZE) { > + flush_dcache_range(start + i, min(start + size, start + i + FLUSH_CHUNK_SIZE)); > + cond_resched(); > + } > + > ret = remove_section_mapping(start, start + size); > WARN_ON_ONCE(ret); > > Christophe --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus