Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4044976ybg; Fri, 25 Oct 2019 12:31:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO37nqILXJ20O/eWDPlH9Xcyfx/X9048zs+SmMh76/HqHUAZ6PAXDVCIafw2rnkNKUR5eJ X-Received: by 2002:a17:906:a459:: with SMTP id cb25mr5051452ejb.63.1572031894201; Fri, 25 Oct 2019 12:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031894; cv=none; d=google.com; s=arc-20160816; b=0peaOnBuA34wobE+oyehPwzmxhKaQWUu6F703p7JPyR3mtwQ4eOgcDPVuSzC5vl+5P owWKM4BCnjZC2zhKX/hfgyYxSApUoE7HRzU8a6pfVhJdYICm6Ni411yDSrLSN277wJQf dHp8gOXl8PIhzyD1hFb8dPvxQInzISeta/ZFmJKaWpqNYQcr8vHm1kwScD/+rQWJAYdN fkQ6BsQZSVtRnoseypmFYc38MRKPppnjJlJJoNMjfqyA05M4BwZ73jbWwJmm5UTLf+rZ gVs1El1Pkb52XfA4LgoWLF24iLgvQhQ3zqclJ21xEHzVYUUQwhKH0+5ZYrOi7Xfe4Nuu uQIg== 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:organization:from:references:cc:to:subject :dkim-signature; bh=fHKlI7wnW8uMQDoEoj1c5yaGeprsprURO6IlKm0Z6Aw=; b=L9JJ1/QxgDYy01WQY0cRV7wYmDpTCjiE4KWPAzxqXJKGqEY4F3gtegpE0Q0KxCMx4O 9t9/gGPSGMPhG+0zFcjknf9NSApItqKSB00L58fkDc34M6rzm1N4uRNyExw+BOWQjtms APrJVzZaWaUR7cm6o5tYYZnfqHKk5aoIUNebfY73be4qcP/G4E2scRrQZMVCWhxML7+7 CtJcpSugN9phi+ANwXx+qkpvh5BmPMQeRDGNbph/b6wABTRV/7ZtIPRVexb4LX83arW3 mC18Hx0+qgLxCEDqbAfsYIkcXJrmLsY6MJdDDqxJanhDP1yVUsH6DjoRsO4nenRlwzCZ PjZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U3w9oqu0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si1733453ejj.70.2019.10.25.12.31.10; Fri, 25 Oct 2019 12:31:34 -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=@redhat.com header.s=mimecast20190719 header.b=U3w9oqu0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408102AbfJYIVo (ORCPT + 99 others); Fri, 25 Oct 2019 04:21:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60931 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405453AbfJYIVn (ORCPT ); Fri, 25 Oct 2019 04:21:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571991701; 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=fHKlI7wnW8uMQDoEoj1c5yaGeprsprURO6IlKm0Z6Aw=; b=U3w9oqu0CAPcYh5mdazxLFaBCZGGePPPVWHV971I7Ok6N6aDmlvdLXJd0NCLVs/VLdKCPf 0Oxx0wMG1u1y1Jlmav9AbBCFbnecWLusqz7ItNrblrIF6+dacWlz/WfcjoN71U7oyRAHVj p0tVuHn2DpqxcMv1p2+/PpbK8iQiweM= 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-14-qKISDm60Oe6kVLJK0KRPDA-1; Fri, 25 Oct 2019 04:21:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9582A1800E00; Fri, 25 Oct 2019 08:21:36 +0000 (UTC) Received: from [10.36.116.205] (ovpn-116-205.ams2.redhat.com [10.36.116.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id F071D1001B28; Fri, 25 Oct 2019 08:21:28 +0000 (UTC) Subject: Re: [PATCH 2/2] mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo To: Michal Hocko , Andrew Morton , Mel Gorman , Waiman Long Cc: Johannes Weiner , Roman Gushchin , Vlastimil Babka , Konstantin Khlebnikov , Jann Horn , Song Liu , Greg Kroah-Hartman , Rafael Aquini , linux-mm@kvack.org, LKML , Michal Hocko References: <20191025072610.18526-1-mhocko@kernel.org> <20191025072610.18526-3-mhocko@kernel.org> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <10350bd9-a0ba-9ba9-82a8-99588acf2312@redhat.com> Date: Fri, 25 Oct 2019 10:21:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191025072610.18526-3-mhocko@kernel.org> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: qKISDm60Oe6kVLJK0KRPDA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25.10.19 09:26, Michal Hocko wrote: > From: Michal Hocko >=20 > pagetypeinfo_showfree_print is called by zone->lock held in irq mode. > This is not really nice because it blocks both any interrupts on that > cpu and the page allocator. On large machines this might even trigger > the hard lockup detector. >=20 > Considering the pagetypeinfo is a debugging tool we do not really need > exact numbers here. The primary reason to look at the outuput is to see > how pageblocks are spread among different migratetypes and low number of > pages is much more interesting therefore putting a bound on the number > of pages on the free_list sounds like a reasonable tradeoff. >=20 > The new output will simply tell > [...] > Node 6, zone Normal, type Movable >100000 >100000 >100000 >1000= 00 41019 31560 23996 10054 3229 983 648 >=20 > instead of > Node 6, zone Normal, type Movable 399568 294127 221558 102119 = 41019 31560 23996 10054 3229 983 648 >=20 > The limit has been chosen arbitrary and it is a subject of a future > change should there be a need for that. >=20 > While we are at it, also drop the zone lock after each free_list > iteration which will help with the IRQ and page allocator responsiveness > even further as the IRQ lock held time is always bound to those 100k > pages. >=20 > Suggested-by: Andrew Morton > Reviewed-by: Waiman Long > Signed-off-by: Michal Hocko > --- > mm/vmstat.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) >=20 > diff --git a/mm/vmstat.c b/mm/vmstat.c > index 4e885ecd44d1..ddb89f4e0486 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1383,12 +1383,29 @@ static void pagetypeinfo_showfree_print(struct se= q_file *m, > =09=09=09unsigned long freecount =3D 0; > =09=09=09struct free_area *area; > =09=09=09struct list_head *curr; > +=09=09=09bool overflow =3D false; > =20 > =09=09=09area =3D &(zone->free_area[order]); > =20 > -=09=09=09list_for_each(curr, &area->free_list[mtype]) > -=09=09=09=09freecount++; > -=09=09=09seq_printf(m, "%6lu ", freecount); > +=09=09=09list_for_each(curr, &area->free_list[mtype]) { > +=09=09=09=09/* > +=09=09=09=09 * Cap the free_list iteration because it might > +=09=09=09=09 * be really large and we are under a spinlock > +=09=09=09=09 * so a long time spent here could trigger a > +=09=09=09=09 * hard lockup detector. Anyway this is a > +=09=09=09=09 * debugging tool so knowing there is a handful > +=09=09=09=09 * of pages in this order should be more than "of this order" ? > +=09=09=09=09 * sufficient s/sufficient"/sufficient." ? > +=09=09=09=09 */ > +=09=09=09=09if (++freecount >=3D 100000) { > +=09=09=09=09=09overflow =3D true; > +=09=09=09=09=09break; > +=09=09=09=09} > +=09=09=09} > +=09=09=09seq_printf(m, "%s%6lu ", overflow ? ">" : "", freecount); > +=09=09=09spin_unlock_irq(&zone->lock); > +=09=09=09cond_resched(); > +=09=09=09spin_lock_irq(&zone->lock); > =09=09} > =09=09seq_putc(m, '\n'); > =09} >=20 Acked-by: David Hildenbrand --=20 Thanks, David / dhildenb