Received: by 10.213.65.68 with SMTP id h4csp2672089imn; Mon, 9 Apr 2018 07:17:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/WIgALv8Cb1l+6AT7cJGWyBylwTlgA9rl+kWk8hCxGmjXasma3yjgANQ7bbyeisNBjwXqb X-Received: by 2002:a17:902:8e8c:: with SMTP id bg12-v6mr1837507plb.295.1523283447817; Mon, 09 Apr 2018 07:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523283447; cv=none; d=google.com; s=arc-20160816; b=AkBm2HN4lv0iXIufca1FRvP7vqAQy5/jjlu1YSdnu4Bd7Crfd4JOqvewea3F6SAGu7 M8w6OqJOG+2Sb3bMX6o9s2O9uaaCByjtDQODFCZgvvVCS2ijbwES/IrQ3G49savNAX1u IJxet6D3HL5E1/nmg7rP4GxDK8+7xgVCHaJIUyv07xE4eBOkchWonR8XqcHEKofUsBjE 55HYiGzXAQmObw1TDP+TZiV5nFTPust34ZcuFxv/mBYe8RLEPjjO5cpeOP7o4Nj8xsQ4 uLOVR5RRkAhdHka5x3DFMQTwA4wYCuAB+SaB8hsgZEOsOOwhxJTsnWHSJbxzZiWsbY6G 3Bsw== 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:cc:to:from :dkim-signature:arc-authentication-results; bh=DxVZHnBgpFDvasvf2Oc+Gtqulclb3lkzS3/guDghlcY=; b=xSka56Lq+Oe3/pMFXvSdOLh6V6HuTckaMc4reIsqSWn7I2MwKyPnAmITbRbLLkvFoI LFNPDX3lG+e9UX7yrUdOwc1byz36FF+nhkjVs9wYXG5kEc7h6praseiT0rHQell0TFTk pv6qii40trU4Sf0kvl4emWRoo4H652w1IFPqz7jNVG/mWaDWGhWhAjYMuf8lIfnQc3FM jj5WekitFLm9Qg/jbdx+9brwIZPnHZPkQfK9fp5xQeMYeCRw3lvfuo28CNfeC2O8jqb5 LhErXej0MZy0lH44NCJTVsBOIx4tdtnIWrDggkM5O0jJ/Zb80bN+fxoiSp2fN81BUzYf mMqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ur+n2A1e; 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 a61-v6si371467pla.271.2018.04.09.07.16.50; Mon, 09 Apr 2018 07:17:27 -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=Ur+n2A1e; 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 S1752601AbeDIOLd (ORCPT + 99 others); Mon, 9 Apr 2018 10:11:33 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36277 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542AbeDIOLb (ORCPT ); Mon, 9 Apr 2018 10:11:31 -0400 Received: by mail-pl0-f67.google.com with SMTP id 91-v6so5234862pld.3; Mon, 09 Apr 2018 07:11:31 -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; bh=DxVZHnBgpFDvasvf2Oc+Gtqulclb3lkzS3/guDghlcY=; b=Ur+n2A1enU3kcB3MxEfLk+qdKUPYcJ4s+ihEp9u16miwr3fADfdlvcSzo/CJImNB+I TFTdgYhER1x+AB7NlUquyAB+HkXFiQ5ZyAQl3cBC/73qW/gfyClzLPQB9qxdky46Jc31 a0epsAnJUNup3X2es3t/FqOyhX7TblPeWivxwNYHjzVEk8gTltPYewee1ZNec/PYEWRk gk7SH0eb9PxaGBndWN1VmKaSPbpWJbfZ6SokZbW37oe1jQ8l4/jD3CRdvTzDFRBR/SLi jEdirQ1vhwYJwkLxKi7DwfQnx5aIe+bWahcH0mKOR5Rs5gyClSut5R7zSG0u3mO/r2zw uv6A== 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; bh=DxVZHnBgpFDvasvf2Oc+Gtqulclb3lkzS3/guDghlcY=; b=CkqxIxU3sQrvd0QGS4u3FE3sQTL1rh3NJn0vVs05kiS37IDkXwtL+QFUeEnMOYii3J vmvATVcNdytZIocgoQ2tCsM7yKIHD1q+cffx+z0O5f+l5pPcmU1zSWgs89o2M+tSYw6T qkQLmRpJPh8zqK7L3YHxwZnU635sAQ+aMTcD5GMG+BzJQ+FQxa5O8qSnoaTYos/pZaWM 4R0+MXcEQ/IgAlMu+oBxvnm+Xgv13M2e8gH4jiB8OlFzA7l5Z9DcQi1ea2adZInEjeo8 F+qykADoQ4u5RRDXcTQsHmpv6R/gBxLdJsEJwkgKPopm3dM69HYn0fluM27wFntVFCCn wMIg== X-Gm-Message-State: AElRT7ENrFE4RyBIU1l5ewkdO61cy2tFfbcFAfRkUhDwkbAm4NBIsamo tmqRNipmAARRJJlKktTRUrciTA== X-Received: by 2002:a17:902:8501:: with SMTP id bj1-v6mr39825541plb.239.1523283091003; Mon, 09 Apr 2018 07:11:31 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id l74sm1268115pfi.138.2018.04.09.07.11.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 07:11:30 -0700 (PDT) From: Jia-Ju Bai To: jon.maloy@ericsson.com, ying.xue@windriver.com, davem@davemloft.net Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: tipc: Replace GFP_ATOMIC with GFP_KERNEL in tipc_mon_create Date: Mon, 9 Apr 2018 22:11:25 +0800 Message-Id: <1523283085-25749-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tipc_mon_create() is never called in atomic context. The call chain ending up at dn_route_init() is: [1] tipc_mon_create() <- tipc_enable_bearer() <- tipc_nl_bearer_enable() tipc_nl_bearer_enable() calls rtnl_lock(), which indicates this function is not called in atomic context. Despite never getting called from atomic context, tipc_mon_create() calls kzalloc() with GFP_ATOMIC, which waits busily for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, to avoid busy waiting and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- net/tipc/monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c index 9e109bb..9714d80 100644 --- a/net/tipc/monitor.c +++ b/net/tipc/monitor.c @@ -604,9 +604,9 @@ int tipc_mon_create(struct net *net, int bearer_id) if (tn->monitors[bearer_id]) return 0; - mon = kzalloc(sizeof(*mon), GFP_ATOMIC); - self = kzalloc(sizeof(*self), GFP_ATOMIC); - dom = kzalloc(sizeof(*dom), GFP_ATOMIC); + mon = kzalloc(sizeof(*mon), GFP_KERNEL); + self = kzalloc(sizeof(*self), GFP_KERNEL); + dom = kzalloc(sizeof(*dom), GFP_KERNEL); if (!mon || !self || !dom) { kfree(mon); kfree(self); -- 1.9.1