Received: by 10.223.185.116 with SMTP id b49csp3208198wrg; Mon, 5 Mar 2018 16:34:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvnBQ8DtXWdLfjYc2fzlU2NUOE67hkPf/GJNqvDDYRKQY2mh65ed/92+QSzbq0gGz41rvx1 X-Received: by 2002:a17:902:467:: with SMTP id 94-v6mr14624967ple.57.1520296461665; Mon, 05 Mar 2018 16:34:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296461; cv=none; d=google.com; s=arc-20160816; b=xSp2V58dK+JVQaGXJ8P4m6J+FVh5Zsk/QVITZUv0zO2QrbL5bTy7ZQPG27r4k91/Pa LPdtyWJd4qHOF7NKFuxi/HnHGlHS85Gr8EICD/9SBaU9CMygwmFOJcuXBO6XmnV9uebv Q99C2bmZ8phEE715reaUryrEw3WE0gOwnpgB8u+FCpQfVfLlV+PAD1mTZQ/nMTpqKoq1 uBSyyaNC0PmFWCAhiq9Ngd0c3FNrsKcXI3Wl51DYp+Kb9t6u44CoF1MwYmo6c1CwBq3M qnzLySEtNWrE0SnUOvm84KdlDtNA0yLpbPUDEBYWiI3ctAehHL1tZIUWvTtV9G9nK2wT MdnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=fy9j7Ex7DSbPwPal+8NDWs399/YcbCBWmlLI8T1XMkQ=; b=RiqgLRd5ve+go6JQtxGoi2LOHfrgWPsgfPgIXg8g3XiEoXttmzgy9EsxKEKTWN+2KZ l6WWG8No4kxIaSc2iHnEBIYFBJ3ro6sitWRjbdm/hd0l+LidF5WbUcIu7Fmrmkr1ToQK yi9eGHjVF3MdntaY3Dh4x3vD6lJ1Lbx2ew9wE5k4HbCn+p5xETUiK93uvnvzgfqqJT9z VeRr/FR3HimzKIhgRC1PyT44nWwjifgUioly2IYR0VkwKCVAC5/bS5rPGBLTfgMMXE1y O+nauhIENaGSiyFzKkAFANsXTGW1Zz1P7LXKe/jBKRqMMXbigjMKxz2EvuBoDAfm1Q9a Vv4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=HflhbJF+; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si9050957pgo.122.2018.03.05.16.34.07; Mon, 05 Mar 2018 16:34:21 -0800 (PST) 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=@oracle.com header.s=corp-2017-10-26 header.b=HflhbJF+; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933650AbeCFAcP (ORCPT + 99 others); Mon, 5 Mar 2018 19:32:15 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:35102 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933385AbeCFA0q (ORCPT ); Mon, 5 Mar 2018 19:26:46 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260Lm8b115099; Tue, 6 Mar 2018 00:26:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=fy9j7Ex7DSbPwPal+8NDWs399/YcbCBWmlLI8T1XMkQ=; b=HflhbJF+VvkyayBu9Jpe0L8gH1OFnBuOhiSWjnBJ/jCK59JriPoyKqQBqXJF+MJ5y0lM R+KwtKbdlGclnhBoXLBX2uCvSXg0H/BIsP8OGG8qxLXrQYerSi/VsGvFTNRdeq0Tq62E XSaAawKTHHtffmrH8GkZVjS//PbicaNHsN3AmReAhFdML5YczswEKcA9L2xP/CkSgwDb Qc/YgP11BIKW3gADwRaT3uGl37REzP8/IGlOgMnM2aniw/haD9s5kLGODWps6aInG2ID +BJayXjIHf8A1iSXHVbpUEzctPdv4mQMcuPyqC6rygX0jR8iDluC+zy1ccvVN5qi2VtP TA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2ghdxf8k5j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:42 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260Qf0t026233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:41 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QeFD022257; Tue, 6 Mar 2018 00:26:41 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:40 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 47/65] kaiser: _pgd_alloc() without __GFP_REPEAT to avoid stalls Date: Mon, 5 Mar 2018 19:25:20 -0500 Message-Id: <20180306002538.1761-48-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins Synthetic filesystem mempressure testing has shown softlockups, with hour-long page allocation stalls, and pgd_alloc() trying for order:1 with __GFP_REPEAT in one of the backtraces each time. That's _pgd_alloc() going for a Kaiser double-pgd, using the __GFP_REPEAT common to all page table allocations, but actually having no effect on order:0 (see should_alloc_oom() and should_continue_reclaim() in this tree, but beware that ports to another tree might behave differently). Order:1 stack allocation has been working satisfactorily without __GFP_REPEAT forever, and page table allocation only asks __GFP_REPEAT for awkward occasions in a long-running process: it's not appropriate at fork or exec time, and seems to be doing much more harm than good: getting those contiguous pages under very heavy mempressure can be hard (though even without it, Kaiser does generate more mempressure). Mask out that __GFP_REPEAT inside _pgd_alloc(). Why not take it out of the PGALLOG_GFP altogether, as v4.7 commit a3a9a59d2067 ("x86: get rid of superfluous __GFP_REPEAT") did? Because I think that might make a difference to our page table memcg charging, which I'd prefer not to interfere with at this time. hughd adds: __alloc_pages_slowpath() in the 4.4.89-stable tree handles __GFP_REPEAT a little differently than in prod kernel or 3.18.72-stable, so it may not always be exactly a no-op on order:0 pages, as said above; but I think still appropriate to omit it from Kaiser or non-Kaiser pgd. Signed-off-by: Hugh Dickins Acked-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman (cherry picked from commit d41f46f778951b0ea851ca52b88b2549c6336b47) Signed-off-by: Pavel Tatashin --- arch/x86/mm/pgtable.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index b0848a7e9c68..20b8438f35c0 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -6,7 +6,7 @@ #include #include -#define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO +#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO) #ifdef CONFIG_HIGHPTE #define PGALLOC_USER_GFP __GFP_HIGHMEM @@ -354,7 +354,9 @@ static inline void _pgd_free(pgd_t *pgd) static inline pgd_t *_pgd_alloc(void) { - return (pgd_t *)__get_free_pages(PGALLOC_GFP, PGD_ALLOCATION_ORDER); + /* No __GFP_REPEAT: to avoid page allocation stalls in order-1 case */ + return (pgd_t *)__get_free_pages(PGALLOC_GFP & ~__GFP_REPEAT, + PGD_ALLOCATION_ORDER); } static inline void _pgd_free(pgd_t *pgd) -- 2.16.2