From patchwork Fri Jul 3 06:13:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11640909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DF20739 for ; Fri, 3 Jul 2020 06:14:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1FB76208B8 for ; Fri, 3 Jul 2020 06:14:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="oSQ4BQep" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FB76208B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 071CA8D0059; Fri, 3 Jul 2020 02:14:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 021C08D0010; Fri, 3 Jul 2020 02:14:02 -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 EA1638D0059; Fri, 3 Jul 2020 02:14:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id D6FBA8D0010 for ; Fri, 3 Jul 2020 02:14:02 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 67694180AD806 for ; Fri, 3 Jul 2020 06:14:02 +0000 (UTC) X-FDA: 76995749124.04.week66_130f81526e8f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 3EEF28014650 for ; Fri, 3 Jul 2020 06:14:02 +0000 (UTC) X-Spam-Summary: 1,0,0,da156426fac67e68,d41d8cd98f00b204,songmuchun@bytedance.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2731:2904:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:3874:5007:6261:6653:10004:11026:11658:11914:12297:12438:12517:12519:12555:12895:13069:13311:13357:13894:14096:14181:14384:14394:14721:21080:21433:21444:21451:21627:30054,0,RBL:209.85.215.195:@bytedance.com:.lbl8.mailshell.net-62.14.0.100 66.201.201.201;04yr7zyticc5mx88tqedebs5exqe1yprcxzaydri48jiec5oeoss6mjz5zw8f1t.zmj3zarboznqi7eiak671c4tym6krwtyayyst1a695ht7bmpjddj6c61g1tpoty.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: week66_130f81526e8f X-Filterd-Recvd-Size: 4096 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 06:14:01 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id o13so11659302pgf.0 for ; Thu, 02 Jul 2020 23:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4EZwpgmE4SueL7e7tjK8HJwbAvV8gZoeqD/srGZ37yk=; b=oSQ4BQepwwyKGLVXlKk03nr1hWc+SmjA2W/HfDTlNPSxskF4OqVSmq0RMfGPlr/07R jUStXAHktVZXZG0cPzgnjsKTVf+I0J4y3B5qwWKX/h6HWRuy5Sn4M6T1/rvgXFnTntqB QmV1YtU8u0/ouw6WR6qHgg60SwBEFbm1OOAdHCY83r+SuuM/40DPg1FpAvx8IVedaQco XjQ7JBAPt4NROlIEax0eclbVYoQIuyl8KwdxZBsw6zsVkBdNzgqM4YGmeYEEU/iSEiKP 0ISl6rX9NzISWAMIexq81r5lXa/MVr6J9dqm2GWZ+b4m7ILLaBLmu17+cEQik0P3B1lv 5WnQ== 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=4EZwpgmE4SueL7e7tjK8HJwbAvV8gZoeqD/srGZ37yk=; b=PtNIdsBzzKdZQrY0+jHbagxH31nkiG/lazTy5uROyhEnMaK1L/+5wN2YEEhSX9gu65 /796fF+GryNDxw7A0nRGeu1sXYpv0CqmYAWIfIGcMgolUcUMMgvg3HtPlDs119C6f6Pc Y9ILDkpBFTDGmTlAtdKVRne4L/42pCyGFsXO1KnLOguNC7/K3XIqGjD5vHKs+iJetj6N P/c+yTU/Jv7DfiRyZviuBTIIC3lULTVfv5n5Z/h6pSr334ETbn9xgLyixkNJx6JosCq0 WTX5RaMDI2pS/gE+PlYOMqafIUMaZseWh+042QtHtkZO3BCr5V2sWTLivtZTghGnM8Gg vtTw== X-Gm-Message-State: AOAM530Xw89v3+Tg1cWO719+CaJXtCGI/5bA7XPxyObo2aeYRRJ07rPd FVrm7guC8KUiRgvw9plOZrYiRw== X-Google-Smtp-Source: ABdhPJxCmD4c8IFGSzGHPg50n9TH1o+RaiKai1/irHgNYxcYmZIzLRcPtjtjRFKBn/GHQ0WBvLeYOg== X-Received: by 2002:a63:1c23:: with SMTP id c35mr26767213pgc.91.1593756840219; Thu, 02 Jul 2020 23:14:00 -0700 (PDT) Received: from Smcdef-MBP.local.net ([103.136.220.68]) by smtp.gmail.com with ESMTPSA id y7sm8642784pjp.47.2020.07.02.23.13.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2020 23:13:59 -0700 (PDT) From: Muchun Song To: akpm@linux-foundation.org, david@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH RESEND] mm/page_alloc: skip setting nodemask when we are in interrupt Date: Fri, 3 Jul 2020 14:13:50 +0800 Message-Id: <20200703061350.94474-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 X-Rspamd-Queue-Id: 3EEF28014650 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: When we are in the interrupt context, it is irrelevant to the current task context. If we use current task's mems_allowed, we can fair to alloc pages in the fast path and fall back to slow path memory allocation when the current node(which is the current task mems_allowed) does not have enough memory to allocate. In this case, it slows down the memory allocation speed of interrupt context. So we can skip setting the nodemask to allow any node to allocate memory, so that fast path allocation can success. Signed-off-by: Muchun Song --- mm/page_alloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b48336e20bdcd..a6c36cd557d1d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4726,10 +4726,12 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, if (cpusets_enabled()) { *alloc_mask |= __GFP_HARDWALL; - if (!ac->nodemask) - ac->nodemask = &cpuset_current_mems_allowed; - else + if (!ac->nodemask) { + if (!in_interrupt()) + ac->nodemask = &cpuset_current_mems_allowed; + } else { *alloc_flags |= ALLOC_CPUSET; + } } fs_reclaim_acquire(gfp_mask);