Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6472849rwp; Tue, 18 Jul 2023 00:26:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0461giUai/UljJnpzjXMQS9Ndde1TXLV6ZgiL+37ZbjAOsYOTnLqjrUj/9mJrctKHJhpg X-Received: by 2002:a17:906:225a:b0:994:555a:e49f with SMTP id 26-20020a170906225a00b00994555ae49fmr1341573ejr.31.1689665162152; Tue, 18 Jul 2023 00:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689665162; cv=none; d=google.com; s=arc-20160816; b=urDiywa9vC+a/fdb5m6UzUlw4Il69NBpqX11YfsKY8k+SZOuorblC8ZTbXYIkbQ0wL QvQRKWDxtUoG2BOMs/uj4IaEF4GHV5XgPIuL7aZdmz2BJ3KiGQWxI0nM+i76OlrV8oZB Wcpu3C9ZU5mo3Xaub0lpJX6M8jNfiz8DNNuEYWPhWIAo+b566/7PKYN/UgZuUIpR2rWY JbG9xQz8OsdvgXPjRofFAT+K7xJ+aUocn+448DJFxpuLIBt4f5u+O1CJzrqPHmvMiaeA 3MU2uooUsERxnVpgkuVIFt5D2b64n+wqFaISdkveW41ocWIOF3O76QOwOuYP58Sq/9Le A5ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=J+3/4KtrV8kbephpJ22EviWFdjs0YaC3yiKObYCwqJM=; fh=kx/7JEwszVkLhM/E9+v9aIXlrFpJoDK13w2s8KsfH+A=; b=n/Uq3GCy+Vb6pkrJGyYiscRfUAQCRR2sUy2ikNn5r1KlQgVBh8w/IlnZk42TsrLxwQ V575jbG62qlNF0h2x/pKJSF/VtsrpKFRukKxgS1jt33Z4YpLBqwd3jc2Kn1CH0LaqFnP GTjmxYBvxtM9TgUCmxY1gLFYvMML0Lacbsu9mUtU+fl6rEZ8A1WoN5nem9V9xssTXduJ Smk5/Qv6HQnFFgZIiPGi/AdUCbrL9c7X+QIhx8GN6LNYBhsmtkSLReiF3MkhhMzjdLgZ o5MLSdWeL/M+AifzZXYOmAL7OapIlZtCx0o/D3icIZkKmQSssMSAzEdi0xtL5i2L1433 74Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RlI9I82l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a170906bc5100b00992a0f83dfcsi794972ejv.471.2023.07.18.00.25.38; Tue, 18 Jul 2023 00:26:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RlI9I82l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230498AbjGRHMT (ORCPT + 99 others); Tue, 18 Jul 2023 03:12:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjGRHMS (ORCPT ); Tue, 18 Jul 2023 03:12:18 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715D510B; Tue, 18 Jul 2023 00:12:17 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-666ed230c81so5476747b3a.0; Tue, 18 Jul 2023 00:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689664337; x=1692256337; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=J+3/4KtrV8kbephpJ22EviWFdjs0YaC3yiKObYCwqJM=; b=RlI9I82l/kFy2u6fnTKaU7c/oVV126yW9wTkZvV9hAL5qomkuipM4CPaxdAc/YkVpR ReFgM728Vx2U5eq95VDoE6Nes/QaGYvnhtafQGVEji2C4KkLctoYfI9KLLUmcr4AqkY1 zPie+6yy4vcEB6RwmYCwbqHkBrws4w14pCzpw3c2f271D++XZmgW6ReOrmY0hNmDsBj1 mtWGdL28PFdgKK2Ngpmfcimc5xw2n3rMsoGoz4DIUwlABkk/56pR16ByctEoGpCsIpig SGed/mNdI56m3t0mCj4g7D/Pi8SiQHRHWCJywoLBYqGLu7p/nwXzyVyIb2z2aElbhZEm vDKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689664337; x=1692256337; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J+3/4KtrV8kbephpJ22EviWFdjs0YaC3yiKObYCwqJM=; b=UINwORi0JvEHvbfMhrLtIAo1HPRe4L8m7CvU5kKTW8X3ohw0sZSvmxrBsCxJJBdxLZ Ysvac+jECSfNFOLAIMabAsUIAeoaQNyetynGDMTLUrYrz8VMPcy4W63QDxeSdxD+NOin hmg5fOmoU7x82faZ/53OYTqpO6LqqryQwEJ+8li2Ime6qMyXN0kz31FzqUDad4KukP/7 zMICUjuZEytEnlVRJcs+bja9ulDzP2gIqFLHT26U0XvV/anmDXFNAnVAfQ4SkrfWPGud mdm1GdVKesLFY+62FiEAXDR2WAmnM43OUSCR0y5dB7e3R3ZMz08HBcA6BUGP0SobU+zR NeZg== X-Gm-Message-State: ABy/qLbX9OgrRK2DhuxIzuz+KjaCSakMyagqWJrEybP9Su8MguMq0Y/4 SiZXOaj8HCshbytVJ1r8sPU= X-Received: by 2002:a05:6a00:1acc:b0:668:81c5:2f8d with SMTP id f12-20020a056a001acc00b0066881c52f8dmr18984419pfv.3.1689664336896; Tue, 18 Jul 2023 00:12:16 -0700 (PDT) Received: from mi-HP-ProDesk-680-G4-MT.mioffice.cn ([43.224.245.251]) by smtp.gmail.com with ESMTPSA id l23-20020a62be17000000b00682a8e600f0sm879553pff.35.2023.07.18.00.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 00:12:16 -0700 (PDT) From: Huanpeng Xin To: minchan@kernel.org, ngupta@vflare.org, axboe@kernel.dk Cc: senozhatsky@chromium.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, xinhuanpeng Subject: [PATCH] zram: set zram bio priority to REQ_PRIO. Date: Tue, 18 Jul 2023 15:11:54 +0800 Message-Id: <20230718071154.21566-1-xinhuanpeng9@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: xinhuanpeng When the system memory pressure is high, set zram bio priority to REQ_PRIO can quickly swap zarm's memory to backing device, freeing up more space for zram. Signed-off-by: xinhuanpeng --- 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 b8549c61ff2c..af56766a036b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -616,7 +616,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, { struct bio *bio; - bio = bio_alloc(zram->bdev, 1, parent ? parent->bi_opf : REQ_OP_READ, + bio = bio_alloc(zram->bdev, 1, parent ? parent->bi_opf : REQ_OP_READ | REQ_PRIO, GFP_NOIO); if (!bio) return -ENOMEM; @@ -746,7 +746,7 @@ static ssize_t writeback_store(struct device *dev, } bio_init(&bio, zram->bdev, &bio_vec, 1, - REQ_OP_WRITE | REQ_SYNC); + REQ_OP_WRITE | REQ_SYNC | REQ_PRIO); bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); bio_add_page(&bio, bvec.bv_page, bvec.bv_len, -- 2.37.2