Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp436213ybl; Sat, 17 Aug 2019 03:53:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxu4qDiH75Caq+X3NHOccQRFDtpZJVtPDsbpQhooTI+DXIcKtbxwgYONxh5SLZuqrwLH0F6 X-Received: by 2002:a63:e907:: with SMTP id i7mr11351792pgh.84.1566039188288; Sat, 17 Aug 2019 03:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566039188; cv=none; d=google.com; s=arc-20160816; b=AsiCEl2z3/bvxIR6h4hR70gQvq6kOwU+sZeq57h2HqchGyXDQMkejUVSdFcY3K0O/n Bg/pLRtOtIEc8BG3I38dpTuL6avNenV/P8Nwhfbv2mmuMGggmlKNmUZkN8nv/Axu/5Zn Ausub5GCyb1gh1FMfhwCKSq6zpnw78IJA4L4mTPvEQFMS1m+JaF2QpjmwbIQwzLjS+JV ST7QFr1RZBtlUJRJvnRZ7izsLdzLMh5nqPOa+FiKNWmt6zhAGfD22G4r5u2VGbF5VkGV Dxqi58GJHcnPjy2w0njhaze65h6kGadhntLxKviBTp2xCGK1kr27SuRsonqYVterEk6Q ftZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=e73g784pEuvRaYkV1Qn8G55TjYtK3ARicu4v3k3AYK8=; b=kAjYy9NXcsxZI1Px6FfT0izRUI/dRiujf8E9ZrWrYDkIxEQlISStOux7Zo4j+ZCKHq et3S8I6jvvVNB6IDsA/gKwwbrySbZERHnM5jQjuXQ8vA73yLZ0gAY+DfcPolzoZQaE4P Q7uNgRaXr7g5h9/ny4syfB3EFqoUuNvYsSBIndXzEFBmxmohbyAlBsMUJ4bLZnlJ/NaX KMhctRhM2qWBajEFBPo746YUKQ5qTYraw0xfJWrZNi/j2w99N6Pdh2b76octp2ZymvtK rpoPoNYjgN9GPUjJIMTlcqRk6CKHOuhfjzJjFkwEmjtXjQgcJopt6JQuYfPQFREGYU+p tHAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="L/TiJYWG"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z72si5566250pgd.34.2019.08.17.03.52.44; Sat, 17 Aug 2019 03:53:08 -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=@gmail.com header.s=20161025 header.b="L/TiJYWG"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725947AbfHQKv0 (ORCPT + 99 others); Sat, 17 Aug 2019 06:51:26 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45042 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbfHQKv0 (ORCPT ); Sat, 17 Aug 2019 06:51:26 -0400 Received: by mail-pf1-f193.google.com with SMTP id c81so4431074pfc.11 for ; Sat, 17 Aug 2019 03:51:25 -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=CMZdwBARnz+5O7gBYh0qyBqicLnQ1IQ0v45O74oG13c9JQa42i+HUGIkkwQsa9x/b7 uL4hrGDqsWXcF7AAu/6SlKJsrCjqpbYMuz9cU3EfmF1MneFdFdXwvrNDRw8EB00GFnJs ARudppkXnNmBjCCCdkDYUu0pRMB/XQtsm1F3V4iXPI1V5n+PVfJUE39FWkU7FayCQyLg FzLA5T73Wm+zpPcOiVaEtm9pz/YlA2uJHHrTPR+IjBCef3//LhXyOqdHfYxXkzFJ3lc+ L9UDYulO8YxpypY/+afqJ7dnqxkQjN8Xi4cWrkb29ulzgZRRYGiE5ikjxzr1nEB6d59w Rd+g== X-Gm-Message-State: APjAAAWfNBcv78V7mD4HZBE5BkXGfIPYEMT35nrKRDkrCfLlUVMt5Wls wx4jDKrrrZ+FYPuWybZZi/4= 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- 2.21.0