From patchwork Wed May 9 19:17:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 10390653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3792C60153 for ; Wed, 9 May 2018 19:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2725728698 for ; Wed, 9 May 2018 19:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BA12286B1; Wed, 9 May 2018 19:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60E4628698 for ; Wed, 9 May 2018 19:18:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C8DC6B0569; Wed, 9 May 2018 15:18:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 250656B056B; Wed, 9 May 2018 15:18:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 118556B056C; Wed, 9 May 2018 15:18:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f199.google.com (mail-qk0-f199.google.com [209.85.220.199]) by kanga.kvack.org (Postfix) with ESMTP id D79086B0569 for ; Wed, 9 May 2018 15:18:48 -0400 (EDT) Received: by mail-qk0-f199.google.com with SMTP id y124so6931552qkc.8 for ; Wed, 09 May 2018 12:18:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:subject:date:message-id; bh=OYcKhSoRVE/2kiDwIJ3ipm4lUUJCa2hjkdBR1M8OBFk=; b=WW2OzJvwZniEDcaLCz8ofp+tvV/TcQm3w3opnz6RdEkjI6W4v7pAh1EE7jf78nYSJQ VXkmg+DtGLmk0BbNEwPsyRcXFKar0rL33iwsVZQ5lpLVlboDhTNtUsTgxJXjbz436Qgd ualpMVcdlEjSXOWhS2Jr4g72mnGXll4snl/Ze61k7kFxycsLofO/dpM1PMhSMkhYXh3r lWaU1GsrxbSlnQg1EiDkuFZcYGo2LneUQXAgZb7EJw+DTY8DbrBECGjeljQlwY5QPlUv UiTqbBioHawpb1wxyxPMLMz61IM2qa5OdB7N2/7yGtxLqL6CYEah7a78AzS79xuG2ySh Jtfw== X-Gm-Message-State: ALQs6tCRHEL8HCys9K0/ff4YD6JRRMqxdl0sannSXIQg7wzFYV5hpMSY PenMws6iu3/FffxaEfCSZqsPTkujDz363NT5CRQeKZjS2rGmmqiOvJ3OlK6zZXiwAPY53tjW2Tk M1CUHvxUwXGFBcjpUY2eCR1MMn1xIBzhKl4A5r9A/aK+WaWLcH3DYoYNbWzGrc6F9wQ== X-Received: by 10.55.42.1 with SMTP id q1mr38080221qkh.137.1525893528585; Wed, 09 May 2018 12:18:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrE90g8EdCczjmD0GjeFJXIv/pHoXBrhQNl52QbCBOQ1Ue74pJ38bw8UhvHPMjOaptZJ5eL X-Received: by 10.55.42.1 with SMTP id q1mr38080183qkh.137.1525893527810; Wed, 09 May 2018 12:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525893527; cv=none; d=google.com; s=arc-20160816; b=mgzh/5oz8G9jacsnl4WonH9U28i1ujw/tdURQgMfKauJ34tgv4jFDOgS12ZShgk6w5 rbQKxyTC+4vr4SwT4N8bT/3L+g6kGIucC5jUxlxXu0dgcyBsjsPt/9QIJCogUNeP4Kph 4IkE04qGibJIa1MWMPtsgjsIHOE/IjNUJ0+p5rQBEPIBsp1kxm0pKEBFOp/w+MEmFM18 VPDAlhbtqrnMvYqXCzb7fc9UY57mfd09DCU6mOIFUTf9AtYiuR3PST4TBt8eI98ou4xR Ss3ke8VQ7tMMErl9I0Opt6YZFgumKaKdPQPLNL28egeNHKaUezk5x0cYxN4BHTTZnfGF 5SSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature :arc-authentication-results; bh=OYcKhSoRVE/2kiDwIJ3ipm4lUUJCa2hjkdBR1M8OBFk=; b=VNixVtQcFV7azX1i6lumSgybMugLeI29oNYsdspj1Nb43S6HO/aPfRx/2XcL+BP/I7 UaF7YtlSsIthH3brpn37OEhDmU2qzqk8VXfIL164AAwOZo0g4dEZzBv+9NcdAAwa0NFC cmqgh3HjD92/qECcWJMfKAgrrzlPz+PcHRk9KzeKLs0XLsn8cWS7rbAMdu/lxcJzWAbY POBXXAthgo2tdI7lBzOs4HI/bPeD7XJcQwcoDxIIM0QbshTHZ58hZ56b3dC3oAlZKy9d vgAYFljpqGX0Rz5j5S1G718LtKzd67qw73f/Aw321/Kgwy9PCHhPqtrdAV6Sod6IvOJl j/Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ijTXWr9J; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id g10-v6si658769qvj.17.2018.05.09.12.18.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 12:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ijTXWr9J; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w49JG2s9094017; Wed, 9 May 2018 19:17:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2017-10-26; bh=OYcKhSoRVE/2kiDwIJ3ipm4lUUJCa2hjkdBR1M8OBFk=; b=ijTXWr9JyOeb54GP0Nj4/m8enfsbjpDtB4uWxltSjRNxHbpDihV3pSG0lqFFRApYOrdJ DuDAUOUVYTh3ihgmjdnAxofSTGoWTd6TparIPsEeH8ic7EQ08pBo1F5xfphGoGRa/KBW /XmdXpYe/yKeQTT5f7kjt+BbTPJXUlFofPaBZZbujE1DX0cmzjPdOIBEMgh9NH2f4oHT CWHtJCNZzF6MjUIrxv3WN96Zwi340N/bLuUC9YChQTVLpClgd6po6eWpJg479DgUN1zN UBmJ4NkxLN5M+wL7DCBjSNhcON6k9Dg8zPI6l7WIg1ZKPLJdJn+ARzW4ZG9n7nUaT5jE bg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2hv6kp05c9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 May 2018 19:17:22 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w49JHMpX010339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 May 2018 19:17:22 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w49JHKH3020990; Wed, 9 May 2018 19:17:20 GMT Received: from xakep.us.oracle.com (/10.39.228.83) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 May 2018 12:17:19 -0700 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mhocko@suse.com, linux-mm@kvack.org, mgorman@techsingularity.net, mingo@kernel.org, peterz@infradead.org, rostedt@goodmis.org, fengguang.wu@intel.com, dennisszhou@gmail.com Subject: [PATCH] mm: allow deferred page init for vmemmap only Date: Wed, 9 May 2018 15:17:13 -0400 Message-Id: <20180509191713.23794-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8888 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=959 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805090181 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It is unsafe to do virtual to physical translations before mm_init() is called if struct page is needed in order to determine the memory section number (see SECTION_IN_PAGE_FLAGS). This is because only in mm_init() we initialize struct pages for all the allocated memory when deferred struct pages are used. My recent fix exposed this problem, because it greatly reduced number of pages that are initialized before mm_init(), but the problem existed even before my fix, as Fengguang Wu found. Since FLATMEM is already disallowed for deferred struct pages, it makes sense to allow deferred struct pages only on systems with SPARSEMEM_VMEMMAP. The problems are discussed in these threads: http://lkml.kernel.org/r/20180418135300.inazvpxjxowogyge@wfg-t540p.sh.intel.com http://lkml.kernel.org/r/20180419013128.iurzouiqxvcnpbvz@wfg-t540p.sh.intel.com http://lkml.kernel.org/r/20180426202619.2768-1-pasha.tatashin@oracle.com Fixes: 3a80a7fa7989 ("mm: meminit: initialise a subset of struct pages if CONFIG_DEFERRED_STRUCT_PAGE_INIT is set") Signed-off-by: Pavel Tatashin --- mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index d5004d82a1d6..1cd32d67ca30 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -635,7 +635,7 @@ config DEFERRED_STRUCT_PAGE_INIT bool "Defer initialisation of struct pages to kthreads" default n depends on NO_BOOTMEM - depends on !FLATMEM + depends on SPARSEMEM_VMEMMAP help Ordinarily all struct pages are initialised during early boot in a single thread. On very large machines this can take a considerable