Received: by 10.223.176.46 with SMTP id f43csp768880wra; Fri, 26 Jan 2018 06:40:28 -0800 (PST) X-Google-Smtp-Source: AH8x227NAewD1CyL2D8Lgnjk2SB0x3jCh5waoNRo4YcpSUOqvVNwRi+TRFzqs1dDdiXxUoMyVhkt X-Received: by 10.98.102.135 with SMTP id s7mr19055299pfj.209.1516977628522; Fri, 26 Jan 2018 06:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516977628; cv=none; d=google.com; s=arc-20160816; b=LZReodjNoe2YrBbCUenvPOOMii2LHHHsBGmM63DOsssPhocA8fJrogxaUenHJx7QFT CVh0Z+5oxSGvwRb7cudyARk3FrGXxP1Wef88fMUPBp66LjcrIKm43USUnps4UUviYsDa To+lVWh8dkrBUF3cAShJx25r1j/4sMdLQJHFAkUNLsAZsJvCsaqn0OH4wPZKUKZ2ZG4t TQ2YHzz4ZRO7DHvPSnusjyZZYyWgtXQYoSw0t+A7DHG1JjhmCN1BY/gRfvZRyrLJmCHz XfRkwH8c8giTBpcccx4R2tArssWeePRE7uqTFwTSe9gjVvIqP4MpAibXeUqCvhN4sEsn W1SQ== 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=92qe9bU2kcJi/1NArR6iAi5PHhUDgIPNGpq2C+yLz6E=; b=DdQsyq6woCv4nos9+hxwgx7loWKh9ssMM1maSm4NNjn0RDnjUx5H5AD0VKZIejWoxE lbdJ1F5v6CQNN7xG4rBHkqqmMHvb9GGkv7Qgme/XGi089hqbH1K/S1oNzwC2VLh3ipcL sww5Xg9dPBhprGrmABTohbW7C+DKrcrNtiNzwUdL81ekq3+Bsd192JAS0kiWnLQbeieG cDvc1g1OWtktE9Ej+JaEHqCoNAF4ZinCUYDutaCIe6gegOKg3un+BlWfvg5hB7wxAIMp PWHy5Al+sXXVCWJHsyAhN3xGmWswMxhO0aGEWA/uZ9OhMgSOUkDwNkFzcOdKWm0CA+nz my8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=niSiapv2; 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=NONE 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 e25si3036191pgn.782.2018.01.26.06.40.13; Fri, 26 Jan 2018 06:40:28 -0800 (PST) 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=niSiapv2; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752950AbeAZOju (ORCPT + 99 others); Fri, 26 Jan 2018 09:39:50 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:42853 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751664AbeAZOjt (ORCPT ); Fri, 26 Jan 2018 09:39:49 -0500 Received: by mail-pf0-f194.google.com with SMTP id b25so370409pfd.9 for ; Fri, 26 Jan 2018 06:39:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=92qe9bU2kcJi/1NArR6iAi5PHhUDgIPNGpq2C+yLz6E=; b=niSiapv2/S5gRS56sN3tyGcFMDQSsMP2zi//rt90dUj/hJ7hH2nStYA8miuIkv1ara kIvvTJBOc5yi4s/Qwap4spim80wkGOUDY5cV5U0/7yDcuWTutk33myirFrVCz9snySOc wHCxluhFIkPpYgjiTaCIec06v7PdvTmeEauTR/M5XBL2JvE36t7xvIc6Y6SBQhDNYojh 1/hePnoDlL2B5MrFyFbR/B9cMrUqlX9AexTeEeVk2WxTbblWVp67a9SiFiNjKZOPQ1Tf zWenG0w+mtUYp3uRvG2Ppn930/VcF3O3TPRDCqKm1x7eh+QIGz5p4r6V5mkt4e0bzBRz JOkg== 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=92qe9bU2kcJi/1NArR6iAi5PHhUDgIPNGpq2C+yLz6E=; b=qY915zw7W4lM0cwdxKbwgmUTk1G3E1yxHkBE+MmkEBlMgi/O4IgqA076MeR0XMi1um UtcFSpgSZ58cRyzMeHqRi4aGeqJARPe7Fqv6uVc9lhoeWxik7CAjMnSWf4B0zBlwn5Du Y7W13uznHdQiVNtoQqT/OJaIa8/2McWQR5IlEaGOE8opk3AdP9hkssQOX4RveBItRUhw OvYux4w6BuvrRSOqH4ughPGGF0iY7fz1qdyLsafxtOWJa7XWA2N/GqCM1fUoTZ64LjXP xspSv8zpR0GN4WG0yNXtzKpvMq3Kg22RfLzKICIvum96TRilujpzAUP74KYTebaexixX NZBw== X-Gm-Message-State: AKwxytfw7ruc5WRmdvnTHe47hUeKL9z++HB5xS30q/KSI8fmPJq+Pcg4 2sjG4Z2JUr4FS5P4EGTYA8FDgw== X-Received: by 2002:a17:902:bcc2:: with SMTP id o2-v6mr10360926pls.89.1516977588373; Fri, 26 Jan 2018 06:39:48 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id t7sm7551853pgu.77.2018.01.26.06.39.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 06:39:47 -0800 (PST) From: Jia-Ju Bai To: philipp.reisner@linbit.com, lars.ellenberg@linbit.com Cc: drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] block: drbd: Replace GFP_ATOMIC with GFP_KERNEL in drbd_resync_finished Date: Fri, 26 Jan 2018 22:44:22 +0800 Message-Id: <1516977862-6492-1-git-send-email-baijiaju1990@gmail.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 After checking all possible call chains to drbd_resync_finished(), my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And it calls schedule_timeout_interruptible() before kmalloc(), so it indicates that drbd_resync_finished() can call function which can sleep. Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/block/drbd/drbd_worker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 1476cb3..7ea56db 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -883,7 +883,7 @@ int drbd_resync_finished(struct drbd_device *device) * is not finished by now). Retry in 100ms. */ schedule_timeout_interruptible(HZ / 10); - dw = kmalloc(sizeof(struct drbd_device_work), GFP_ATOMIC); + dw = kmalloc(sizeof(struct drbd_device_work), GFP_KERNEL); if (dw) { dw->w.cb = w_resync_finished; dw->device = device; -- 1.7.9.5