Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6482719imm; Mon, 23 Jul 2018 19:50:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfAbuROg107NzZPT9fDqoHaQP3pq6zRHldpTvf4jcu9wiy6+/LjOcImaEHOVV1x0ir+agBr X-Received: by 2002:a62:129a:: with SMTP id 26-v6mr15842446pfs.102.1532400639448; Mon, 23 Jul 2018 19:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532400639; cv=none; d=google.com; s=arc-20160816; b=iOge2ADo6l7RRBr+XP1E9pnPC2h58AaL/e0ldw9R6wGsQ2u8GLR3ygjBOv6JtbE3r1 xmPzhkWg9B8Ukzhtw5Z4k9SfesoC+yMAGsC4I0/ct7DFEVoKmLGn+maTNAmKzo6VFy9A piwircS7KmhIp8jMUrqxhNX1DB2Pqrx17AxO4aB9x8/5seYEEHFd7UYRbz1OpUmEfmbC yNPPsKAlteSKJ95P/tdPqc6+vA86lexn9J8NWOMzYG2Gpqd2A5GckSF/IwIYr5FH9szV iM7Nrpt4NyKy89F3naP1nBfeeni2hsbDE0Wd2EJVtSjjdRevPvu70jGpMo1QX8xpfVx9 RSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=2PQiYLdDdeRp/8QszUvPx0PPwB+0WG2v4UDK3qY/Bvk=; b=mI5c6+g2ctdMCe5f6DGPGt6T1eMKidEbHCmP5Hfzo1NhGBl8GIXhV+WkFAQpKj8NPw ViGO2Uf6rICbzxY+XKFc5mPiogzvVi7VoSCvZlGhVCold/Z3t5WyDazstqiVmZUnmaE1 DHSwlQxaDpC1VVU7iSdmdqdsdcD3/np2aiUpUYYUfUCL87ULh0m4EfglaHD1V/hVUWo5 /CGLufNw3ooKSpNC8pvlU/PfFhe+J0b3IyI5a6qsavn9mDoadFbTt/jwVd9t9qez/Wme aAa4rnG+gXIKzfdqPKLn3D38NNs7flnMokZ1qvxWdWRAAO99iW48jUqIaPvYPsqJqxHy NGcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PTUnzDY6; 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 e12-v6si10611468pfd.38.2018.07.23.19.50.24; Mon, 23 Jul 2018 19:50:39 -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=PTUnzDY6; 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 S2388440AbeGXDxR (ORCPT + 99 others); Mon, 23 Jul 2018 23:53:17 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44430 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388233AbeGXDxQ (ORCPT ); Mon, 23 Jul 2018 23:53:16 -0400 Received: by mail-pg1-f196.google.com with SMTP id r1-v6so1750963pgp.11; Mon, 23 Jul 2018 19:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2PQiYLdDdeRp/8QszUvPx0PPwB+0WG2v4UDK3qY/Bvk=; b=PTUnzDY6EvBiYjA5RIpo6Eq2MiAOGbslJclfjnj3g4RwQOIZA8DkZUuVu5h236t6lO DzykJllWFrCbdYZ8OliZBu/AwWEZ+QudEQwsigG2AFZ0NaLNaVBeGplTa956XsAXfgg5 D4fvO+f1fuu5/5TZbXutvTZ0fUtafrxcgKoUEqhNqaXrWuQEWDvqWgGyXiuvk/rVkiKq QTArawC9QI+St3d3DqoVEVuQsKzDQqmNgS1cwatAMPtMcPJeJ/UR29EZrFPDc1iEUnw+ CijXT1tQ/1xRknYrLoUf54AWhr/shrXQWx8gFJ94Fw58n6lGZZRbhFTLBJhPXOkCE/Dx xoBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2PQiYLdDdeRp/8QszUvPx0PPwB+0WG2v4UDK3qY/Bvk=; b=g5mecDz6HgS1vyn9zH2GmtNMTfon57fXnVyEYcQu09sxrBxyoFe3BjpKa7w2kMS1XG eG9ZJUOrI7frp/8ZUWAVzIi1Ln3Q+qYSxTVUDSjK61aObmEvUKBaXUkFxMYB06ppacWd /j11AB5LnY4unKNNVhNdGHqDDBQ8S7UsCamX/G6WPQ5Gjr5OOP1DEQebkAe94NOkqFKy SdTXkgBKQcRLd9d1PEBGi1lfyOW8QH24atpQq8UNtTXnbc+rUtsInofVLX4Sm6YI5NLD rzgGOIiLvmwh8cIq2hxoviqngQx193kMsyepw4gpoo9WR27bLin/uY4jQ8fTnvge9yZJ EBVg== X-Gm-Message-State: AOUpUlH4DXwbUD+nnDY9zfLs+xrb4ztiQe1cor9gSB3RUlLWQdSxmljb Obh17gFYUDIAGorEaOiBAbE= X-Received: by 2002:a65:448c:: with SMTP id l12-v6mr14052571pgq.277.1532400545229; Mon, 23 Jul 2018 19:49:05 -0700 (PDT) Received: from localhost ([39.7.53.222]) by smtp.gmail.com with ESMTPSA id w11-v6sm13350901pgm.82.2018.07.23.19.49.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 19:49:04 -0700 (PDT) Date: Tue, 24 Jul 2018 11:52:28 +0900 From: Sergey Senozhatsky To: Jia-Ju Bai Cc: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, axboe@kernel.dk, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] block: zram: Replace GFP_ATOMIC with GFP_KERNEL Message-ID: <20180724025228.GA558@jagdpanzerIV> References: <20180723141304.3300-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180723141304.3300-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (07/23/18 22:13), Jia-Ju Bai wrote: > 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. [..] > 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; I think the intent here is different and is not related to atomic contexts. Consider the following OMM -> swapout -> __zram_bvec_write() -> write_to_bdev() -> bio_alloc(GFP_KERNEL) -> [OOM?] So maybe we can do a bit better than GFP_ATOMIC (NOIO, etc.), but in general, I believe, we can't use GFP_KERNEL [at least in write_to_bdev()]. -ss