From patchwork Mon Aug 20 08:55:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10570003 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 1404C109C for ; Mon, 20 Aug 2018 08:55:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 026C3290B5 for ; Mon, 20 Aug 2018 08:55:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E86A72927D; Mon, 20 Aug 2018 08:55:37 +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.9 required=2.0 tests=BAYES_00,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 7F4E4290B5 for ; Mon, 20 Aug 2018 08:55:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB7246B1838; Mon, 20 Aug 2018 04:55:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E67436B1839; Mon, 20 Aug 2018 04:55:35 -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 D7D556B183A; Mon, 20 Aug 2018 04:55:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id 7EB6D6B1838 for ; Mon, 20 Aug 2018 04:55:35 -0400 (EDT) Received: by mail-wr1-f72.google.com with SMTP id l45-v6so7886508wre.4 for ; Mon, 20 Aug 2018 01:55:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=vOAG9J8xNcAmcPq+gbmE7nnOc0++fGPWH3tYcBqm7Zg=; b=uaX/Ol0M8/lfzHNl9D8otNQe0wTveI/qJqIJD4W7C9y41IaV3eKs/DvtjHzI1Weews Gj/aGVtCaFWFCns4zHzDQGj8VUTudDhVWOZ5LsQvsz+gbwAIz8dpZvuBM47H7OhyU/Ip imbuIhyb2sRiDJfRkSZYhZvznX9Z3T5SQOD7l72UMDF2IlLDbtun7mpemEKLdhJzv0gp u5xHKcZYR/Fm+G+/iFXlChsFFkGW+WsoyvdCd7qmNYrm67y5d23qq+lqd1pXZp3HCbWt eKmgGo43JtdYoD8QNuXx2SQYZvF5+djEK1oDcAmfC/lIGcYzdDX8u71Z/c5+o5Qr71Pe ITEg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlHXv/PK1cJ2P4vRX6dwPmYZ2zvjVWEUw2GlnE2uIPN47riQ7+VZ Ye+MZR/T3q358qu+GIX6lNkivZoeHa+WgJwKIymWFVstNaKnLGno6bXQdki0qBbulr2KawwQPnL QqIaSAstop5AD1bO8GEFQNRM4HsIyMH7D8RZKW9Z6s2c1rcmdhyloRyR4uDu0j9iUbbwVXgh53Z RBl3CnQV05l5svlqRcoVkY9Vy8Zbhpma9rcznzxm9bBNSYpxbiEb/OKt2Ii3lKIRxbWMlWvpt9M 2QphsT5RGpNKGDaZWThAcTUE82sFTv8gUrI6Psv5MsItyVRkWQQmW3blc+gvPGjnwBGpQzjCsA1 22dqiHSaMX4hWsYlOrht+00N0OamL6WXrIx66AlhqpEZ4DcZ+MtydficBEPempoUyTLmXHLcTQ= = X-Received: by 2002:a1c:c95:: with SMTP id 143-v6mr26491022wmm.50.1534755335043; Mon, 20 Aug 2018 01:55:35 -0700 (PDT) X-Received: by 2002:a1c:c95:: with SMTP id 143-v6mr26490983wmm.50.1534755334200; Mon, 20 Aug 2018 01:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534755334; cv=none; d=google.com; s=arc-20160816; b=NrgVP3C9XebpYPFt9RY7E4gYYITeeP2pR21Rpc+VGQZ7a+Om2o8af30ofL2ZUXMz1n UU+vnaU21mKymrz5fjKVim6riyL2hVIQDqOjRAFlj2HNALA1ecHg4SFcl4JZN5m9tNA+ j2kCfZLnfbduPiyBwhc6zEanjc6ALlvycA+9ptBnssTbVBxZuVYToqzT60cjEN20MoPs E8xTeiXOshTH+RZ7vx873MLtufAfU0bj5STv71DyGqD0qnw91ita6JrDVouxO76koAef wfPhaPD34BjE4CVcT3Q5HL3NCZkpjGhpmc75XFNq6uBTKdemMZkJ3kTTs1StzpjsKC2B gZmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=vOAG9J8xNcAmcPq+gbmE7nnOc0++fGPWH3tYcBqm7Zg=; b=anTBWIySrQL0kCQd9FQSY/6zabyxGj5BJXCF3NKmJ+Xey+pjqVMCd8znilMoLFeC7z bo0bvKKJX261yNQYtrWtqexP5OaD46DrTNxwUAZPhuT91gn6S1L7h3dx72PN6uyDUvO7 3VIh3pTED8YEzVCknxeN6/bsRCObkJeqiA5yH1poVv79lQbkG4kwqpv27iIXaQvWefXT E1366uIcEl+ChuUCyG8YufGWfc8Ur2XTpDbhBgMAAER5otrC8fUVvsbXB+U1CFX/ojO0 gV7KljSK6iBYza6yNviwIn+ngSovew7m5JPIOgWzZPwy2imfryVHX8zzw7OsRxKz2LT6 5Ivw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o5-v6sor2757246wrf.33.2018.08.20.01.55.33 for (Google Transport Security); Mon, 20 Aug 2018 01:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AA+uWPzXWxJSK+j+LOYTqMlgb82j7NdeBNLEu0LiwrXpemVRedjNjh8xP9bI8ZFzlwY5o8y7hXxdJg== X-Received: by 2002:adf:959a:: with SMTP id p26-v6mr27740008wrp.202.1534755333703; Mon, 20 Aug 2018 01:55:33 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id e137-v6sm18222010wma.20.2018.08.20.01.55.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 01:55:33 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 4898412492D; Mon, 20 Aug 2018 10:55:32 +0200 (CEST) From: Oscar Salvador To: akpm@linux-foundation.org Cc: tglx@linutronix.de, joe@perches.com, arnd@arndb.de, mhocko@suse.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [PATCH] mm: Fix comment for NODEMASK_ALLOC Date: Mon, 20 Aug 2018 10:55:16 +0200 Message-Id: <20180820085516.9687-1-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 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 From: Oscar Salvador Currently, NODEMASK_ALLOC allocates a nodemask_t with kmalloc when NODES_SHIFT is higher than 8, otherwise it declares it within the stack. The comment says that the reasoning behind this, is that nodemask_t will be 256 bytes when NODES_SHIFT is higher than 8, but this is not true. For example, NODES_SHIFT = 9 will give us a 64 bytes nodemask_t. Let us fix up the comment for that. Another thing is that it might make sense to let values lower than 128bytes be allocated in the stack. Although this all depends on the depth of the stack (and this changes from function to function), I think that 64 bytes is something we can easily afford. So we could even bump the limit by 1 (from > 8 to > 9). Signed-off-by: Oscar Salvador --- include/linux/nodemask.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 1fbde8a880d9..5a30ad594ccc 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -518,7 +518,7 @@ static inline int node_random(const nodemask_t *mask) * NODEMASK_ALLOC(type, name) allocates an object with a specified type and * name. */ -#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */ +#if NODES_SHIFT > 8 /* nodemask_t > 32 bytes */ #define NODEMASK_ALLOC(type, name, gfp_flags) \ type *name = kmalloc(sizeof(*name), gfp_flags) #define NODEMASK_FREE(m) kfree(m)