From patchwork Wed Jun 3 15:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11585963 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 98D4A618 for ; Wed, 3 Jun 2020 15:51:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F12F20738 for ; Wed, 3 Jun 2020 15:51:45 +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="ZyLX+Ych" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F12F20738 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 3ACDE8E0007; Wed, 3 Jun 2020 11:51:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 35D648E0006; Wed, 3 Jun 2020 11:51:44 -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 273688E0007; Wed, 3 Jun 2020 11:51:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 112408E0006 for ; Wed, 3 Jun 2020 11:51:44 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 935101874B1B4 for ; Wed, 3 Jun 2020 15:51:43 +0000 (UTC) X-FDA: 76888340886.12.thumb27_490ec6eb1a147 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 04E51182F5237 for ; Wed, 3 Jun 2020 15:51:42 +0000 (UTC) X-Spam-Summary: 2,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.214.193:@bytedance.com:.lbl8.mailshell.net-62.14.0.100 66.201.201.201,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: thumb27_490ec6eb1a147 X-Filterd-Recvd-Size: 4064 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Jun 2020 15:51:41 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id m7so957411plt.5 for ; Wed, 03 Jun 2020 08:51:40 -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=ZyLX+YchCvrvF4S+nVRMqtygJMKIGErfDWpiKzoDhP8bOjlMaHxMfNopmfNWUpsJnH 1SxKh8z3fnAwBXchSotzz7Cdri4LUXklamhV0zEbTNhbmc1voenNMpi2IO1hX2aX9QTo 2tyEPya5rCe7i+QcHuOzoxfig97Hr76dORbmrVZXyxeTqbpIuPCuqdMbJg3BS1NcSlhu ZXgJu5XW3LCB4V5MJxB7m14GnDgc/6jZScAolGB/54a1vkoLXjDYimVOUo733q+zZAa0 lGW7gfMobnnl9SizU4NI5nWKF4ipByvCnII9rLTsGRMqhO4i2MCfhYjkULrtoUgyPkHk fbHg== 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=sW7QkzdwBTn+vBHGy44rE+VfDY/txmynsBsIgUtFCz8j/059Y5ydaKhn+ypy9U3oht rx7SPQzSM2Op+ocNc2BWiqSetOKs8kTxYfROmjwQBK9y26gSdIqJtOOTchTqRQLYiAYD 58x5URXZU1Ui0aoo1gaJijqrDzlCMPTGs56CUtc1dyEFbSQcO2xZo+XZkfp6l1FesvP9 4th9VBkTIWPl3E8OCPWmOS5pKZAN1zSVMOhq2/MuGtWOEJKjnQzMgGqTDOMMmyG74JCT lZY05B4D6ctq2Mj9lLBmBE+KpPZzo3Zfu0WRDhhVI4lp61m/mz0hzegCpuKI70/3Sj0y CmYw== X-Gm-Message-State: AOAM530307329rwKZBeyRtBSetLEqFOT94Ncx3jIkRMhVF6aex4ArmDC IKVXAik4MZZ5LVWfnsSkEp4RtA== X-Google-Smtp-Source: ABdhPJwhCy0NCR2rHQD0wojHcHwNw52mcwGqMJ3XgoD3/b5iqUSSMYoW5hWg74FT61Zd2CagbT1fZg== X-Received: by 2002:a17:902:6903:: with SMTP id j3mr531245plk.110.1591199499859; Wed, 03 Jun 2020 08:51:39 -0700 (PDT) Received: from Smcdef-MBP.lan ([103.136.220.73]) by smtp.gmail.com with ESMTPSA id 205sm2283117pfc.206.2020.06.03.08.51.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2020 08:51:39 -0700 (PDT) From: Muchun Song To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm/page_alloc: Skip setting nodemask when we are in interrupt Date: Wed, 3 Jun 2020 23:51:24 +0800 Message-Id: <20200603155124.33981-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 X-Rspamd-Queue-Id: 04E51182F5237 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);