Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1562523ybg; Wed, 23 Oct 2019 18:24:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR+jDO86p3+8Vnka2pELZnLQ8b0Mm35eEU3ws0ewfne7YTYbsCG570xBGqFo8QgckYQoKN X-Received: by 2002:a50:e71a:: with SMTP id a26mr40330408edn.265.1571880256893; Wed, 23 Oct 2019 18:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571880256; cv=none; d=google.com; s=arc-20160816; b=FoRPbQFLyJYCHZ0OeaWe2RJ+KTQmGGm+kV2+IuKBYjxHAx08QnHrIKKuCiAgPgB+to wLADqB1HDo56O7itHjO3Xt68p9d2Fa+L3WChLjPesGQZmgSHIgv2K3Y3qJIhBfMOqqHe O70hAmjt31o77amdENJgyPPelD4MygcQaWCNrbzDuX/k22qGzJ14tYZYztOohWVooVl/ 5xpQapXMH44krgCpnzHhXJKM1mSuQ70h1Ix4rmuG2brIXS5bfrtPFVw6t0gudPVhBSIL c/ZBiqGYR+hCaIYPCcmnKl93svVJ0iZTCL4ALvw+8UJ8z5fvY8LZjaeBc3UzXDlVjDDf jMdA== 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=dFr4auTB5WCyyB+oGj7EM0Xur1GVbDsBycmZZyHEWFI=; b=kb0vviBmzIE7Nf/HaM6CGSqGOlO30Tu+bbB0XJ8QVVCRrqqggZkziUuHrwkHDUNWcZ nzz5m6uL2a8xlkxWosoIOJhScK0iiAglnQuu5X+EWQooImbIsV/zlJ9cCNQhH0zRnS0u neJ6KrTIDgVqVpSOISI5T3p/8dz+dkwIkvIjGenoUnuAiGRSEEGf8ykTBREXU0uNJEIy XtVCAYyH+RoBt4Ej6IW1Vq3Kqxvhqlz++2J9JFumf6EoTMzWYOtBA4hQdwguCSMlbKuc Z0WwUbdIFPWACLDP6pHxKIFYeNoPcZ1KS8LE+4wlGn1EMwOWh/jh9mEyujjY4GPS4Q1D Sk2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BwfD6rNm; 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 ly27si44448ejb.250.2019.10.23.18.23.52; Wed, 23 Oct 2019 18:24:16 -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=BwfD6rNm; 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 S2405356AbfJWO4p (ORCPT + 99 others); Wed, 23 Oct 2019 10:56:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32742 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390185AbfJWO4p (ORCPT ); Wed, 23 Oct 2019 10:56:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571842603; 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=dFr4auTB5WCyyB+oGj7EM0Xur1GVbDsBycmZZyHEWFI=; b=BwfD6rNmNvETo/OaSPeV6cXtCW3j15gHtTC42V4Hhq9pGJg1+yD8uoth3KBo88lUo7Ry6l b1NoFeTJ9Kuum7KH3Sbf8niO6+XIWJc/M38jVxYLnwelqRWWBGO4rURXoxY5A8o8cCR0vS pqrIi/Q9lbo0R1Q3YMLQhCf8d0BNSFE= 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-25-7rKysA6pPnepJMF_sEPftA-1; Wed, 23 Oct 2019 10:56:40 -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 53E7D1800D6B; Wed, 23 Oct 2019 14:56:38 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-59.bos.redhat.com [10.18.17.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F8A3194BE; Wed, 23 Oct 2019 14:56:31 +0000 (UTC) Subject: Re: [RFC PATCH 2/2] mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo To: Michal Hocko , Andrew Morton , Mel Gorman 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: <20191023095607.GE3016@techsingularity.net> <20191023102737.32274-1-mhocko@kernel.org> <20191023102737.32274-3-mhocko@kernel.org> From: Waiman Long Organization: Red Hat Message-ID: Date: Wed, 23 Oct 2019 10:56:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20191023102737.32274-3-mhocko@kernel.org> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 7rKysA6pPnepJMF_sEPftA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 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 10/23/19 6:27 AM, Michal Hocko wrote: > From: Michal Hocko > > 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. > > 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 putting > a bound on the number of pages on the free_list sounds like a reasonable > tradeoff. > > The new output will simply tell > [...] > Node 6, zone Normal, type Movable >100000 >100000 >100000 >1000= 00 41019 31560 23996 10054 3229 983 648 > > instead of > Node 6, zone Normal, type Movable 399568 294127 221558 102119 = 41019 31560 23996 10054 3229 983 648 > > The limit has been chosen arbitrary and it is a subject of a future > change should there be a need for that. > > Suggested-by: Andrew Morton > Signed-off-by: Michal Hocko > --- > mm/vmstat.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > 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 seq= _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; list_for_each() is a for loop. The continue statement will just iterate the rests with the possibility that curr will be stale. Should we use goto to jump after the seq_print() below? > +=09=09=09=09} > +=09=09=09} > =09=09=09seq_printf(m, "%6lu ", freecount); > =09=09} > =09=09seq_putc(m, '\n'); Cheers, Longman