Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2691316ima; Mon, 22 Oct 2018 14:14:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV638I5wDCThX04g7o97DNGYL0Pwgou4zAACFGZQR+KZmMSR6Vttd2S7c9BWKMUpFxRHL9EX3 X-Received: by 2002:a62:2845:: with SMTP id o66-v6mr46876679pfo.17.1540242873570; Mon, 22 Oct 2018 14:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540242873; cv=none; d=google.com; s=arc-20160816; b=oQAILayBig0VOgCY+BTBwk/F0MK9ag04yF7g7EevQDfcwX3xZh0vxZFg2EdiaZo8X4 LTf8GPgB9G6BWKV6oxKGfVl/dzkLaHV2Mf0xLcnEkxBoY062f0C0+1PzpZKd+XNMB4Fl A7zglUa5QVmJttKq+UBc2kkhWn8ceJq1rQNMoiu8ByDY9kNZLnmoZnVWbuZCT2s5SmTH ytKHLce+Jx3fuDf2xJtxkqfPiSVwBKVvlc5jTRREDh4CVtzZOqw4PINi1EWA1uSwaaSZ RNPljL5UJhxDgC6Svt8K31bEWifoJcIN7Lkt08MfMZrcGeGkeQ0vi/XBeT4Kt0TW9gXF qxAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=msqS4RKF1mEugZL5tume/ycelvRiVwR7DkoKhlUMkwo=; b=vYCOKG8wEGCGFtA2+FL0NmfSaz5hvbKNJLfQVs+CCF4ef/oWhTEDXitfbKKxO7LnTg PFuDeyDIcnaieViTBRG/jc4sIrHydiFtEZ5p7SxobwqFC+PcHm0MFvlaFv11sfBBqnAF EeKQ+xK3VNvheF/P/VQJX3onmV7MEc9OTtTBqsGn4Ckc+7XRhhinm4oYoB3wO3IEDfzM apxKmQjtg6x1kn7NEqVNooF8Udm8tImppd2ZX7EDsi2lpW0w+zGJuvevG6vd5U43qPgI 0Ij9qlL7Ybq5B2n42pHg+sWDs5y1+2EZ3Wf3Mz44gThI5Er+T1lFpULGW5O9mHcBqfQj m2cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mAltxJwX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c184-v6si34868961pfg.215.2018.10.22.14.14.17; Mon, 22 Oct 2018 14:14:33 -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=@google.com header.s=20161025 header.b=mAltxJwX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729133AbeJWFFX (ORCPT + 99 others); Tue, 23 Oct 2018 01:05:23 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33201 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbeJWFFX (ORCPT ); Tue, 23 Oct 2018 01:05:23 -0400 Received: by mail-pf1-f196.google.com with SMTP id 78-v6so18118528pfq.0 for ; Mon, 22 Oct 2018 13:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=msqS4RKF1mEugZL5tume/ycelvRiVwR7DkoKhlUMkwo=; b=mAltxJwXlKWU/VsjWWGkjp5EYBzH72taQx3NhcQoxPsY3cHYNX8pnMoSkzAd4f91w0 uyIzhbF0/OEt1Vc3L6B+nvJVRj3mukc6cM2z3eXEK5EaoJqmq4EKEbL7RlMwFimtG1Ko MFljBwdObpNfKP5k716Zcr4WhSdBtBsXHeOSYxY6BpUnIk7TcrrXwWb39TweRPgTiIYq 1QT6uIrWfhLFOiOaw/80UwH2hZI7mbxxylVqC5juAUSb2Rpi7PIUMKZl+g8+j5D3/4ZA tTJwaleyVL+8R5csiQxS9H3ayoczYEMs+ycCzYdu3ZCaKJ740B+2udvRtOZDx7XMp4HT FVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=msqS4RKF1mEugZL5tume/ycelvRiVwR7DkoKhlUMkwo=; b=VrhtbeA/PCntzb6FCLLsMM90M2wfWSCxIIobxbfstO6aFYOfGEV2wWzeiVaVl5Pphr AULBscKz92nTYMwFNWvjLw99SndmL/gztZ+JO0p2ssRd1ppkF5FOd1jJmseSdYooz9s1 wySfpEjwyaDxJSD5YKIFY4gMCfaaAlJUn7ipjinYbE7lvMSg5nKZ55oFthBrDD++AU06 nkwqMsDd79b9Ne39ZSdH/3QlOHWXt8A1RgmbNkzAh+0KKPqGZkvJRVt7Zssfnuu7JDzE M3RfK1VTtrZDmUroQCDgXHjqh4VPitC00kF24YhNKh2iPbvqpYrWUL+xLx65288RT9CL 3NzA== X-Gm-Message-State: AGRZ1gL+8+J4SJ10k63TA9s2jtj2iZgx9aY/nyV3t53eKiLRnIa3jMQy gpJjlF2/EvmRL+BUZHXNY1YCXA== X-Received: by 2002:a63:3f44:: with SMTP id m65mr4898315pga.115.1540241118321; Mon, 22 Oct 2018 13:45:18 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id r73-v6sm51487507pfk.157.2018.10.22.13.45.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Oct 2018 13:45:16 -0700 (PDT) Date: Mon, 22 Oct 2018 13:45:15 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Andrea Arcangeli cc: Michal Hocko , Mel Gorman , Andrew Morton , Vlastimil Babka , Andrea Argangeli , Zi Yan , Stefan Priebe - Profihost AG , "Kirill A. Shutemov" , linux-mm@kvack.org, LKML , Stable tree Subject: Re: [PATCH 1/2] mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings In-Reply-To: <20181015225743.GB30832@redhat.com> Message-ID: References: <20181005232155.GA2298@redhat.com> <20181009094825.GC6931@suse.de> <20181009122745.GN8528@dhcp22.suse.cz> <20181009130034.GD6931@suse.de> <20181009142510.GU8528@dhcp22.suse.cz> <20181009230352.GE9307@redhat.com> <20181015225743.GB30832@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Oct 2018, Andrea Arcangeli wrote: > > At the risk of beating a dead horse that has already been beaten, what are > > the plans for this patch when the merge window opens? It would be rather > > unfortunate for us to start incurring a 14% increase in access latency and > > 40% increase in fault latency. Would it be possible to test with my > > patch[*] that does not try reclaim to address the thrashing issue? If > > that is satisfactory, I don't have a strong preference if it is done with > > a hardcoded pageblock_order and __GFP_NORETRY check or a new > > __GFP_COMPACT_ONLY flag. > > I don't like the pageblock size hardcoding inside the page > allocator. __GFP_COMPACT_ONLY is fully runtime equivalent, but it at > least let the caller choose the behavior, so it looks more flexible. > I'm not sure that I understand why the user would ever want to thrash their zone(s) for allocations of this order. The problem here is specifically related to an entire pageblock becoming freeable and the unlikeliness that reclaiming/swapping/thrashing will assist memory compaction in making that happen. For this reason, I think the order >= pageblock_order check is reasonable because it depends on the implementation of memory compaction. Why do we need another gfp flag for thp allocations when they are made to be __GFP_NORETRY by default and it is very unlikely that reclaiming once and then retrying compaction is going to make an entire pageblock free? I'd like to know (1) how continuous reclaim activity can make entire pageblocks freeable without thrashing and (2) the metrics that we can use to determine when it is worthwhile vs harmful. I don't believe (1) is ever helpful based on the implementation of memory compaction and we lack (2) since reclaim is not targeted to memory that compaction can use. > As long as compaction returns COMPACT_SKIPPED it's ok to keep doing > reclaim and keep doing compaction, as long as compaction succeeds. > Compaction will operate on 32 pages at a time and declare success each time and then pick up where it left off the next time it is called in the hope that it "succeeds" 512/32=16 times in a row while constantly reclaiming memory. Even a single slab page in that pageblock will make all of this work useless. Reclaimed memory not accessible by the freeing scanner will make its work useless. We lack the ability to determine when compaction is successful in freeing a full pageblock.