Received: by 10.213.65.68 with SMTP id h4csp138267imn; Fri, 23 Mar 2018 00:58:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELsVHj03V64p1bRJ3Y6WumvXq+2gq4bZA2rRHV/46+syNktv8dlpUfX04JN7ZeH0kjOUpoez X-Received: by 10.98.14.215 with SMTP id 84mr18856248pfo.168.1521791938058; Fri, 23 Mar 2018 00:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521791938; cv=none; d=google.com; s=arc-20160816; b=de4pKVY77ncOv6zbmA08ggBtesPo92V0I/rGJ+jzzxbkFJIPNLttBso2fe4VCogYu2 z+ejU73OhmO56oTkbVpSYUtzeusP8SFqerksKxJv/f3nSDPV57XhzSNB8KZH+z4qjWIF Ney1T6Uns+45qrUi1Vkc40Sc3+3/o5YAB6XEzeHuBG2JrRGEF8odIbG5qgEvgcAqRb1o i+RfkVUDLi71neH3l9Nn0GRXPf4pdUPb4GCVjnHyc9HLiWKJHlFkc90G3QdLzvhE5swU shxBNOROq0cv0Oj7oq4PfpKo5y59ai8/tFbNbDpQq1BAZpK3VwU4OssH75tBc8/2OgMa vNGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=KDfk+vG/y5aXWMi9MtKCrIl2QNkomUEa2hFtyuDrFxY=; b=BoVdwpJJ6xckpeqsXFA6lBdQm8eopB2isZZWYXT+RDdp5XsX0Q75GN5lrV/F05j5j8 1pqbZFNHqM4TK0kidzbTbPTgX30PumtLvrVZBfD64OKVKjjRJdy98Xl2B9o+jYHnF1Kl vTlKWJaHm+q1WyFWxFEm7mgW5YVFmu/+ugEv8g2jEFypIA/lKQ+q/lsV9ZtOjIeuCWCC XicD6dqxMDOcitRzhgXcMs4pUFxwcCpk0Iu2x/+L6B2u/isvgdP6a8l61zna8Qxe9XHB za2sUuVjXQCd3RezezYrDBUzWvq+dICpSjwyB40U2QKcA0wcigt4JRqydHTorHArybBD KA0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i9/98BoG; 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 j8-v6si8547388pli.9.2018.03.23.00.58.42; Fri, 23 Mar 2018 00:58:58 -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=i9/98BoG; 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 S1751597AbeCWH5n (ORCPT + 99 others); Fri, 23 Mar 2018 03:57:43 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:37797 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbeCWH5m (ORCPT ); Fri, 23 Mar 2018 03:57:42 -0400 Received: by mail-pg0-f67.google.com with SMTP id n11so4299018pgp.4 for ; Fri, 23 Mar 2018 00:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=KDfk+vG/y5aXWMi9MtKCrIl2QNkomUEa2hFtyuDrFxY=; b=i9/98BoG4S3r1f1wYvOSi0ZrFom4gukgYgb5dCmYlH4oDtiLqHNb2QV64Ju6wJc8Lv dtPGfKn8SkHoGmbX3LqYHXPYcc4JhCKrDHhISd2Rbx20Rb6j8lKzcCGBB1ouXoj1tUbZ wpEC4S7R82rgbPFgjOdDZSVpq+pXpzYyS3QDAttnAoWI6ni1qGR/a+TQMFSdYzRSxlfe xnwzx12p5DTuY3btXtfEOcyMcxT3Ww3a3NlO+lNErk6xfm8n2AaJG+Gg/bdtHmMb91kJ Q3waSKLU5Hryd404AQtVEWdh9ZGXHxcMC2yHze+G6ApWKwGVTqYTecVKlqJRnrkEL5MH Dk+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=KDfk+vG/y5aXWMi9MtKCrIl2QNkomUEa2hFtyuDrFxY=; b=SER30ByGviptcQNeOQ6CLIn9BeF2jr30Bo3yQo1D2z8Sb422n6ZKST9HnRisVnFD89 bUTN1TesAw3WXkFwDNh8KsJ5Z3s7bWGYUA+7q+0IESDosM8otl8EnCfLK2lIh9Lepxmq 2qN20FnzXwDKHMLZ3yHqbSwEvGAIFc4q7fWppWDGj7vmGq6Owk2dXqfcWP8Du45UqHH2 plu6Tl7Tx8FFgChg61Y2G9/rA2xjQHOOiKf4rGDwHujMFW34cyjsimENA7qTFi4JYkOz +FyGsxln827rgFW+Ocivqb+EH3uLOf05WojWRJeCn6A3Or5S5wP9DR7EKp3VoaJwbcsl POeQ== X-Gm-Message-State: AElRT7EX21ljXzsH0HtQp/G/1ZlmSMlvtE1EMKdKEO+woMcaJBVK+uyr vJ1cocAAWtDAj7OQWtsEU6c= X-Received: by 10.99.166.10 with SMTP id t10mr10922940pge.357.1521791861604; Fri, 23 Mar 2018 00:57:41 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id z15sm14269995pgr.68.2018.03.23.00.57.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Mar 2018 00:57:40 -0700 (PDT) From: Zhaoyang Huang X-Google-Original-From: Zhaoyang Huang To: zhaoyang.huang@spreadtrum.com, Andrew Morton , Michal Hocko , Vlastimil Babka , Mel Gorman , Johannes Weiner , vel Tatashin , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-patch-test@lists.linaro.org Subject: [PATCH v1] mm: help the ALLOC_HARDER allocation pass the watermarki when CMA on Date: Fri, 23 Mar 2018 15:57:32 +0800 Message-Id: <1521791852-7048-1-git-send-email-zhaoyang.huang@spreadtrum.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the type of 'ALLOC_HARDER' page allocation, there is an express highway for the whole process which lead the allocation reach __rmqueue_xxx easier than other type. However, when CMA is enabled, the free_page within zone_watermark_ok() will be deducted for number the pages in CMA type, which may cause the watermark check fail, but there are possible enough HighAtomic or Unmovable and Reclaimable pages in the zone. So add 'alloc_harder' here to count CMA pages in to clean the obstacles on the way to the final. Signed-off-by: Zhaoyang Huang --- mm/page_alloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 635d7dd..cc18620 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3045,8 +3045,11 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, #ifdef CONFIG_CMA - /* If allocation can't use CMA areas don't use free CMA pages */ - if (!(alloc_flags & ALLOC_CMA)) + /* + * If allocation can't use CMA areas and no alloc_harder set for none + * order0 allocation, don't use free CMA pages. + */ + if (!(alloc_flags & ALLOC_CMA) && (!alloc_harder || !order)) free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES); #endif -- 1.9.1