Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1286075ybg; Wed, 23 Oct 2019 13:18:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMWkPr7w7AIS1WK9EFGBgUR3VmZAIzT3Z8PLWCqrtwU3rE97hxlgVS/9KQcSwPLptHZu9y X-Received: by 2002:a50:cc43:: with SMTP id n3mr40293696edi.287.1571861928331; Wed, 23 Oct 2019 13:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571861928; cv=none; d=google.com; s=arc-20160816; b=IHqYp6/s7nvOSDafiwQmyVj9/j8SUhkbszLZkUxT92GCAOyIzesvzKYNtur6IgJQyI P4WQzeFvoQTLI4fxXCENnR/QPG42UzOsHfOuCciNJaCcdTGqyDQR6JxlB+byugEF7m+/ sX3A+eWhwYWN+KmtxdvbsKOpp8ra+hfpftA3J0lTbbOvVs2u68I5zzxWm8zrPnas1MQy Wms4asmxJGmAK90qBMy75Ji9CCai6j03rdazVOzJvRYO7Q0ysDgrYkpD6xw4f9n0ZhBK 7Sg4ridr4+4FDCDsex46JNBeec8+FJgtX1LllPmIDBXQPuSU/VARL0CNYIx3ubI7PXmi zLBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=580cpyTZn31Tsw5lMtWLo7PXKcx4eNMbv5larOIYwnY=; b=snykC4ojVdOqqcMghATDnlTG8pdHjjldrtLvX1fpVgMiRSbg+yRisAbr7nr8rf2DkA r5ejlUGUovWfWc93HpwaAwQ+r6ELTqPtYd7n549zk4VQS5xemQtqsdpVWyK6UzNZgGYD Sq44HSUge0Q/sWgBzsVbijz8fhH45vMfpqkmjjY7qIlx6jMAiaO0EKwiMGnutS7VaNp7 UT/TzZgLJHyZmv+0oEcZ1lNr6UZaHa2v3Smokp0apo0Br3mpqZQre7cBNxa+8S9Ow4YJ W+MVCgrGUmtmp7V/1HSXYPWkBeQl7sXysJLxEIvWsAhui5uwtYZUITKwKtBV1HwuRN9L Vovw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dRUBgccV; 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 g21si13372038ejk.23.2019.10.23.13.18.24; Wed, 23 Oct 2019 13:18:48 -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=dRUBgccV; 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 S2406101AbfJWNqi (ORCPT + 99 others); Wed, 23 Oct 2019 09:46:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42714 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729191AbfJWNqh (ORCPT ); Wed, 23 Oct 2019 09:46:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571838396; 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=580cpyTZn31Tsw5lMtWLo7PXKcx4eNMbv5larOIYwnY=; b=dRUBgccVcuJCmFQ8WF4IqNlYta0SpjjDTABJu3i4ug77Iux62v8IKs5wQX2FQJh7lWMHSv cigKnyS2jdzVDVLkWFPGc3MB2SYiNYVCk6zOjI4G1xs8+Oyr+1xzl9IiX/Y18A92zyaDYN sa9AcneI/MI8Aaspm13rI05Z/tEVUJ0= 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-378-HjTE_xT0PXuakUoiGj67-g-1; Wed, 23 Oct 2019 09:46:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2DF81800D49; Wed, 23 Oct 2019 13:46:32 +0000 (UTC) Received: from optiplex-lnx (ovpn-112-50.rdu2.redhat.com [10.10.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 245C319C77; Wed, 23 Oct 2019 13:46:24 +0000 (UTC) Date: Wed, 23 Oct 2019 09:46:22 -0400 From: Rafael Aquini To: Vlastimil Babka Cc: Michal Hocko , Andrew Morton , Mel Gorman , Waiman Long , Johannes Weiner , Roman Gushchin , Konstantin Khlebnikov , Jann Horn , Song Liu , Greg Kroah-Hartman , linux-mm@kvack.org, LKML , Michal Hocko Subject: Re: [RFC PATCH 2/2] mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo Message-ID: <20191023134622.GA22601@optiplex-lnx> References: <20191023095607.GE3016@techsingularity.net> <20191023102737.32274-1-mhocko@kernel.org> <20191023102737.32274-3-mhocko@kernel.org> <30211965-8ad0-416d-0fe1-113270bd1ea8@suse.cz> MIME-Version: 1.0 In-Reply-To: <30211965-8ad0-416d-0fe1-113270bd1ea8@suse.cz> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: HjTE_xT0PXuakUoiGj67-g-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 03:32:05PM +0200, Vlastimil Babka wrote: > On 10/23/19 12:27 PM, 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 therefore puttin= g > > a bound on the number of pages on the free_list sounds like a reasonabl= e > > tradeoff. > >=20 > > The new output will simply tell > > [...] > > Node 6, zone Normal, type Movable >100000 >100000 >100000 >10= 0000 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 > > Suggested-by: Andrew Morton > > Signed-off-by: Michal Hocko >=20 > Hmm dunno, I would rather e.g. hide the file behind some config or boot > option than do this. Or move it to /sys/kernel/debug ? > You beat me to it. I was going to suggest moving it to debug, as well. =20 > > --- > > mm/vmstat.c | 19 ++++++++++++++++++- > > 1 file changed, 18 insertions(+), 1 deletion(-) > >=20 > > diff --git a/mm/vmstat.c b/mm/vmstat.c > > index 4e885ecd44d1..762034fc3b83 100644 > > --- a/mm/vmstat.c > > +++ b/mm/vmstat.c > > @@ -1386,8 +1386,25 @@ static void pagetypeinfo_showfree_print(struct s= eq_file *m, > > =20 > > =09=09=09area =3D &(zone->free_area[order]); > > =20 > > -=09=09=09list_for_each(curr, &area->free_list[mtype]) > > +=09=09=09list_for_each(curr, &area->free_list[mtype]) { > > =09=09=09=09freecount++; > > +=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 > > +=09=09=09=09 * sufficient > > +=09=09=09=09 */ > > +=09=09=09=09if (freecount > 100000) { > > +=09=09=09=09=09seq_printf(m, ">%6lu ", freecount); > > +=09=09=09=09=09spin_unlock_irq(&zone->lock); > > +=09=09=09=09=09cond_resched(); > > +=09=09=09=09=09spin_lock_irq(&zone->lock); > > +=09=09=09=09=09continue; > > +=09=09=09=09} > > +=09=09=09} > > =09=09=09seq_printf(m, "%6lu ", freecount); > > =09=09} > > =09=09seq_putc(m, '\n'); > >=20 >=20