From patchwork Tue Sep 4 18:33:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10587765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E870920 for ; Tue, 4 Sep 2018 18:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2890129CAB for ; Tue, 4 Sep 2018 18:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C5DD29F9F; Tue, 4 Sep 2018 18:33:50 +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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 A463029CAB for ; Tue, 4 Sep 2018 18:33:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80D2A6B6EEC; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7E2FD6B6EED; Tue, 4 Sep 2018 14:33:48 -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 6D3706B6EEE; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 303B56B6EEC for ; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id j15-v6so2385010pff.12 for ; Tue, 04 Sep 2018 11:33: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:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=J24v41mJ4FOtJxOB7uWev9BUk9KfBzQo0Jgw8/nL6Wlg8TZtMx3XwjY5zR3TeQMpX/ 43DoaeDL0QY2rDm6Pr1xdDS3PRSk8SqdTf7bImNhh/9nhZjKf/m6NKgmmSt2BIMUc3N1 ovjHqsq9rddnPjikDUSfsiUBj+pXmZyNptcBDCADVGBg/uTVHrfYsUvqL+HU1BR2zGXG z5xISOGue8H6ot2Jo7qFz8Qqs6c54HLzARAs/WlOEag1MUhUOIoeYNe3qbg3PW+PLgv/ YEKnlnzQLYyhpQqGi3lMjj/x3crwwszvz3RVi3wLmCTKb0AKhL4Ukpx2yZmTo72cw2+9 Hb3A== X-Gm-Message-State: APzg51BonFU+nkCPBJaufx9fUsbjqut9DBhVdX3q5ce+kDuAC81nlfvc qVu9Pp97eWXMF5piywIQlj4WNhEU3outCVWxdWDZ5LmGu1JXM/wwuwMWs9tbp+0p5GFAVaTmc5s KYJf7IgD9knC5Fva3MgJnx7N0I4T4RpcfaDN9ktIWYEgY5DhB+WBor7FoGNDxCk+8zlvMuhpZYj Grw71BPGjA/qxIJeVh8FlWeuFxhnQ1Cuy/wG6Oo2J8A2KXIemvWMiBlMbxG9MNDsKxRZlFHU/83 v6zXDGpnO0lJpwUMYd4YCOyNsXMvyliWHm+dlRqgG7DFx+6gavvI8kpKxj6xaQwieJbFCw96X3t q8kIU51b7C9qeY4mew3V84zua46m/WwyvAanRC73+d4h/wKKPJXCuPPUr6/QtO0rirjt47lRg45 S X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr32997896pgc.172.1536086027880; Tue, 04 Sep 2018 11:33:47 -0700 (PDT) X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr32997860pgc.172.1536086027103; Tue, 04 Sep 2018 11:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536086027; cv=none; d=google.com; s=arc-20160816; b=uNfCiOehzzRmYknAQf8H1JrL/hYOHKOtj247NCmB1As8D+bkYIgZjmkuId2ojfo0BK SnWSLSjohaXGAoAQ7BZkQAuEype6M9Bi3IgCjPI5+YBZHvp4rxrlK5m32xGvXRGNAEsG c2odRveVTLAZCy7GyVmNccwp7EOPt01P58c7IO9xnjMTuxWBmVL52PjBRYBURWwiTsEU hGH41HwKowpJ0X93fvAeZWJf1PexGrpqTBBBq5dsQ5tN+ZOg3PZb+7S+vU4gEuJEl+1j XMtdRlW9CZ1zn2eJqwjYmC1GM99LL5tQSqgbJV3cFhjVKdmpymyie+NYOFK3QLVEC2M2 LCoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=y8tdimRt/alMuttStqjJWJzyNnK33BoWApyzvtWzqsl9+7BDpuEJr/cUMjYu3PWRv5 yBSezEOuCSX9RPoqsgtw2+FKAzov/zPcUBGGvpPx3ukkQ8aWw6eo05EwdagSXpjt9ROI +H/mA/ACq+tD1yecUF2TCE6ENYS/Wn6gwugSyWzRIgzTtp9L+Xppf2Is62PX09N5Q1D8 kHuHvIBZ92OAG+PjZCXFSnpZjld0vuSZGy+jZxrSW3QlOM5EEgXqF0QSvncLZk4aKB+d pFH+LglEngmCdDIsY4rToCWLDyjl9XEV4whG/j0XYpNz2MkvkRA8+lW1GRFfPm/OCTyM jHLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vAymjcbr; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s14-v6sor4961050pgh.317.2018.09.04.11.33.47 for (Google Transport Security); Tue, 04 Sep 2018 11:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vAymjcbr; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=vAymjcbry74LyDWWHChMOMli0JaF9Rn1u9+l/ZJehXD6D1Ov2IWrReo5sVaZSuMBHx uRql+te+bsLLUaVXxUaUT45NJ3XZvFwmEhHHVGRyVTVdh8yrJhzP53urc2lHn1CrYeUd u5VR4nXMOycYVJM4T4oXYW9N2MyZltBXQrShL8oqAp0G2jR0rJn0vZxkFziLQpjxlSLF MaJBw0jbGi4CMUv8DNpAWt+k/9UuQHYyFFdXBYQKLLSBVtEdAW97Z8GxdR/SB0YRhQU8 HxTPetcm2cQ4HB7iLcXPmyP1IfiaDHd8BfV34mbRp6YYlAXIYVSOjeu+1XB9ETZJWwwN d/wg== X-Google-Smtp-Source: ANB0Vdb3Q48obLzoVJB5Ry2gw1LRc+dCnMA7DUTg3dsOdugcCA0UW9ef986wZqHTXpDLKdMb0XpMMQ== X-Received: by 2002:a62:9349:: with SMTP id b70-v6mr36589325pfe.193.1536086026730; Tue, 04 Sep 2018 11:33:46 -0700 (PDT) Received: from localhost.localdomain (static-50-53-21-37.bvtn.or.frontiernet.net. [50.53.21.37]) by smtp.gmail.com with ESMTPSA id n83-v6sm38725497pfk.19.2018.09.04.11.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 11:33:46 -0700 (PDT) Subject: [PATCH 2/2] mm: Create non-atomic version of SetPageReserved for init use From: Alexander Duyck To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: alexander.h.duyck@intel.com, pavel.tatashin@microsoft.com, mhocko@suse.com, akpm@linux-foundation.org, mingo@kernel.org, kirill.shutemov@linux.intel.com Date: Tue, 04 Sep 2018 11:33:45 -0700 Message-ID: <20180904183345.4416.76515.stgit@localhost.localdomain> In-Reply-To: <20180904181550.4416.50701.stgit@localhost.localdomain> References: <20180904181550.4416.50701.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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 From: Alexander Duyck It doesn't make much sense to use the atomic SetPageReserved at init time when we are using memset to clear the memory and manipulating the page flags via simple "&=" and "|=" operations in __init_single_page. This patch adds a non-atomic version __SetPageReserved that can be used during page init and shows about a 10% improvement in initialization times on the systems I have available for testing. Signed-off-by: Alexander Duyck Acked-by: Michal Hocko --- include/linux/page-flags.h | 1 + mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 74bee8cecf4c..57ec3fef7e9f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -292,6 +292,7 @@ static inline int PagePoisoned(const struct page *page) PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) + __SETPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) PAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) __CLEARPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) __SETPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 05e983f42316..9c7d6e971630 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1231,7 +1231,7 @@ void __meminit reserve_bootmem_region(phys_addr_t start, phys_addr_t end) /* Avoid false-positive PageTail() */ INIT_LIST_HEAD(&page->lru); - SetPageReserved(page); + __SetPageReserved(page); } } } @@ -5518,7 +5518,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, page = pfn_to_page(pfn); __init_single_page(page, pfn, zone, nid); if (context == MEMMAP_HOTPLUG) - SetPageReserved(page); + __SetPageReserved(page); /* * Mark the block movable so that blocks are reserved for