From patchwork Sat Aug 17 10:51:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11099059 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 672EE912 for ; Sat, 17 Aug 2019 10:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BA9828A5C for ; Sat, 17 Aug 2019 10:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25CAE28A5E; Sat, 17 Aug 2019 10:51:31 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 02FE428A5C for ; Sat, 17 Aug 2019 10:51:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C97786B0007; Sat, 17 Aug 2019 06:51:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C21846B000A; Sat, 17 Aug 2019 06:51:27 -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 ABF7A6B000C; Sat, 17 Aug 2019 06:51:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 857FF6B0007 for ; Sat, 17 Aug 2019 06:51:27 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 21C131260 for ; Sat, 17 Aug 2019 10:51:27 +0000 (UTC) X-FDA: 75831603414.03.stop67_ca1bf86b5a3a X-HE-Tag: stop67_ca1bf86b5a3a X-Filterd-Recvd-Size: 4623 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Sat, 17 Aug 2019 10:51:26 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id b24so4474004pfp.1 for ; Sat, 17 Aug 2019 03:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e73g784pEuvRaYkV1Qn8G55TjYtK3ARicu4v3k3AYK8=; b=L/TiJYWG28ghyEkJJ1i8Rr0nYi5kkM/z461r7S6FCzbiM7pHaDaBzgwwzbry0aiV3w oSVTjm9psNf7L6J9IIcLSeAKSoXVUC/3HGuk+i9ul7pxp4ZckhTMMfiGpRCHTTmhuSI4 EsbN86FIPqbXsG0zpy35IsWfpnYh3V0cfiphaIHgODHB19qrSJeSZZpXVvb3StqvwFJh 5hLn3wwiJxuCDGXIjcS6D5mkl8n9qNLnkjzwVlXAEMo0S4XRS1cv4gTazZqqK0P9JtO+ MhGo9wF47uXF7qVpKMCdr4mcqgGqEXjwqD7k0oX0/YU1B7dxJuRFiO90BTPwZK/JNGLX kINA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e73g784pEuvRaYkV1Qn8G55TjYtK3ARicu4v3k3AYK8=; b=lBxA06Ta9kswxgj9GHjG0XN/oT+qkkYyqomISfBSVybLR6vAHCTZ8QxdW5eAl9wl/B TN5A/lT5Gvriqq0CBorBT3WZDPnvLof8FxwipPcvVybxnjE56OFMeJivVpDpl0BD/A8Y +lQSr2KUtPD9oGcQDp4/rFROjdzVvtVm2qLbaZO1vmZoYaR+mL6uTlo+Az+X4r20Ziwg gM14cdGw8dT8FtGI/hTaQWa08QwkA+Uy4XgGfXQRPDVWU1nWn1dKwkLvoi5l6SwPssYo BUXHK5Z9JIIRrwlaos1TAo9aScQoDuIKyZZGgMLMp8M8BDr+CEnzOmZ0iTGc37VmSYTc WqUA== X-Gm-Message-State: APjAAAWTSNSWFZeOomCn4NG0LeDZEmgvEIMVCebG+r79dzgDcta3zRhW BOIrmkfqFH29oqOdUNk8+mI= X-Google-Smtp-Source: APXvYqxy7g7+zbKxk+cAbT0qd+YvQjEWcC7SI9W4jBPUYcJHNSQ/ApGRe7qOaI4sww4O4RWdBWwFEg== X-Received: by 2002:a17:90a:5887:: with SMTP id j7mr11346687pji.136.1566039085619; Sat, 17 Aug 2019 03:51:25 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:ac8:b8c3:8577:bf2f:3]) by smtp.gmail.com with ESMTPSA id f26sm12910838pfq.38.2019.08.17.03.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 03:51:25 -0700 (PDT) From: Pengfei Li To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, osalvador@suse.de, pavel.tatashin@microsoft.com, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pengfei Li Subject: [PATCH] mm/page_alloc: cleanup __alloc_pages_direct_compact() Date: Sat, 17 Aug 2019 18:51:02 +0800 Message-Id: <20190817105102.11732-1-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 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 This patch cleans up the if(page). No functional change. Signed-off-by: Pengfei Li --- mm/page_alloc.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 272c6de1bf4e..51f056ac09f5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3890,6 +3890,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, enum compact_priority prio, enum compact_result *compact_result) { struct page *page = NULL; + struct zone *zone; unsigned long pflags; unsigned int noreclaim_flag; @@ -3911,23 +3912,26 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, */ count_vm_event(COMPACTSTALL); - /* Prep a captured page if available */ - if (page) + if (page) { + /* Prep a captured page if available */ prep_new_page(page, order, gfp_mask, alloc_flags); - - /* Try get a page from the freelist if available */ - if (!page) + } else { + /* Try get a page from the freelist if available */ page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); - if (page) { - struct zone *zone = page_zone(page); - - zone->compact_blockskip_flush = false; - compaction_defer_reset(zone, order, true); - count_vm_event(COMPACTSUCCESS); - return page; + if (!page) + goto failed; } + zone = page_zone(page); + zone->compact_blockskip_flush = false; + compaction_defer_reset(zone, order, true); + + count_vm_event(COMPACTSUCCESS); + + return page; + +failed: /* * It's bad if compaction run occurs and fails. The most likely reason * is that pages exist, but not enough to satisfy watermarks.