Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5855814imm; Mon, 23 Jul 2018 07:14:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdiYy46TlQ/wgO1IjikkGjWVQ0i+HcC/h8eMHSF3fsTkhqzgJ8hUN0cB/Gl+RdTgD1i+Wda X-Received: by 2002:a65:6699:: with SMTP id b25-v6mr12543515pgw.426.1532355284882; Mon, 23 Jul 2018 07:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532355284; cv=none; d=google.com; s=arc-20160816; b=kse/cBVZ4xYURxACOlHu0rP4LZK1So9vORgrHWYTgP6Wy/e8cAG1U1OuOo7ExR0VUY Y/BCO+IZWpHOzBExrBSSf3Jjg0ZyK7jml2y0ZF5lHFnqNgsBGGYZJpsA+G10wQ3pjUPB INw4STeQk381He8rqCQsvGjMrokqe6EiRnrk8uTXFFl4Fs5kOHp2xhmpJqhnxLHOueJg //3SlcSBvC4exNNnyE3hDVv9zDC6MFjiVHzqr5BTCmdzAP81TnAECrS1VmzBPrMS+tLt vE9/9nD5TH4Fx/9RzNk6kikeD9+iCY4gZkWq/Ljau+OJuzlFkZbJZoZIggCQIr9LToQy 9zQg== 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=RkQAA3E/9j5+VGD84stNgIqiheckzY73SWOYx7+yMDw=; b=gSpltQ3jZhSFBKNCCd7DlRRmqYwq+d9ECp1spPzVc9sfhM6ylsWtMu8XXccJG5dhGk Gws8p41txNIQTVQuPX3jG1PTB2LN3BIbf4T/SpK9E+ULd2KtDEd5f2a5vzBoMf+AlXoD di8XOFJLGsr57tYBWyoQXzXqFqYqrjSkLRwPQ8hU7jgojPCQtR4R7ufXeDLvMPEyiti9 oX10M9Ey2a/bBSORS5yfigLWFOq/aR5+rxSe1vwp4RmRhOpvxGq/PisjMET7bqOCdrGS cUNLzQ96c12syIa4ymbku/NjPhmHEgP8RWRKb50oDH+PBSYgoyib1RGZV9RAMdOuuXaL lHHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c+zy5r7l; 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 b8-v6si8212383pls.392.2018.07.23.07.14.30; Mon, 23 Jul 2018 07:14:44 -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=c+zy5r7l; 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 S2388346AbeGWPOn (ORCPT + 99 others); Mon, 23 Jul 2018 11:14:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45719 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388162AbeGWPOn (ORCPT ); Mon, 23 Jul 2018 11:14:43 -0400 Received: by mail-pg1-f196.google.com with SMTP id f1-v6so473518pgq.12; Mon, 23 Jul 2018 07:13:17 -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=RkQAA3E/9j5+VGD84stNgIqiheckzY73SWOYx7+yMDw=; b=c+zy5r7lDrAqrXtJCr9tzH2MiE2x7QYKICUJrGKCNB7YNectiJXn26UGfLz6V0653g JZ7wOXYzIJ0I3pMJPIvEWRzk+y+ZWsoWKa5xGXAT15gjllMoNNm2fP9EnhyOXfm80Agr RIqSQPxTEfXuBVtW1m1pHBEPDaMw7phSsPfrSGLKejfUFWIHY5zGNgNF83P7MP343gCt l3Ev5W8AuH43a7wezhRAJzWas9fcfyNAar6dwanRJsee61pbM/DnU19+WmYPG3MMlzjY 8ePMKxzFDVqq74iU7H/O+lGIk0ZCFE9KfXrI5TGYXXtO/+vozSYXxUbdmUJzHbUrxe2a wfrQ== 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=RkQAA3E/9j5+VGD84stNgIqiheckzY73SWOYx7+yMDw=; b=O2NK4HtKt92QGLV7ntVpzt1n5IeeZONjmlpl19ln9lf2eSKPGrouv0aew+My5Pr0qN rwhsYXPA7miTZQDsXvdFrEs5rK4h9sHgrkZ5MC8f+xwOTOalePiXApq4MHJVp4ldyA48 lQAW3Ag1A2arPfBzm5XmSlTWqMsFg0uoxxi2oAAif1iGVKUIaRAdj+e3IEPpC1+w9vdW +Fw/Au9u/OrxaC13FEpn/GPMdAmpOiHA9FchRgltLMQVPj0B4Pu5gEmA3KwPDIdkqRK8 +7AqTjVX+2ew8zCvdm/W1XdFwsPJqHQFI6Fecsri2NEB9bIa3fntnEmD74MbRuy25khr kGDg== X-Gm-Message-State: AOUpUlEIxpx0O9eW0JsmlyDvs1j52cd7Md9HLtYzqvkio1aBJm/SmX3X wrBh3HNoEyo+7w2faV5N/4g= X-Received: by 2002:a63:c60:: with SMTP id 32-v6mr12493682pgm.155.1532355196825; Mon, 23 Jul 2018 07:13:16 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:e422:450a:e730:728b]) by smtp.gmail.com with ESMTPSA id u185-v6sm13872075pfu.134.2018.07.23.07.13.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 07:13:16 -0700 (PDT) From: Jia-Ju Bai To: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] block: zram: Replace GFP_ATOMIC with GFP_KERNEL Date: Mon, 23 Jul 2018 22:13:04 +0800 Message-Id: <20180723141304.3300-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org read_from_bdev_async() and write_to_bdev() are never called in atomic context. They call bio_alloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC 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/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 0f3fadd71230..b958ed0b8c35 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -450,7 +450,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, { struct bio *bio; - bio = bio_alloc(GFP_ATOMIC, 1); + bio = bio_alloc(GFP_KERNEL, 1); if (!bio) return -ENOMEM; @@ -538,7 +538,7 @@ static int write_to_bdev(struct zram *zram, struct bio_vec *bvec, struct bio *bio; unsigned long entry; - bio = bio_alloc(GFP_ATOMIC, 1); + bio = bio_alloc(GFP_KERNEL, 1); if (!bio) return -ENOMEM; -- 2.17.0