From patchwork Wed Jan 22 05:57:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13946862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C70CDC02182 for ; Wed, 22 Jan 2025 05:59:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D0D8280002; Wed, 22 Jan 2025 00:59:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 580BD280001; Wed, 22 Jan 2025 00:59:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 421A0280002; Wed, 22 Jan 2025 00:59:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 23706280001 for ; Wed, 22 Jan 2025 00:59:33 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D357FA134E for ; Wed, 22 Jan 2025 05:59:32 +0000 (UTC) X-FDA: 83034035784.22.C5ACFB2 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf08.hostedemail.com (Postfix) with ESMTP id 002D816000E for ; Wed, 22 Jan 2025 05:59:30 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="dQp/lPW8"; spf=pass (imf08.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737525571; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RlO1kRVQLX8+VpLXbuNkwAyTGyYAX3nxybEwBuf8gq8=; b=wBt278VhCSlrgG72hsfinxVaHqOnqluaFpTvpe35pGJvGOlA/ffPPPpyuFeEUN7nAXc0Ye GeAqCJ1eDL7OZ24DLxlQTIjsWvXSrO5YAFk+sNBVOUMxW02KWltJQtfWo+G9spPuDgmBYn MXrL4byyJxVGY4lJuMqhESIBWyBKyZs= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="dQp/lPW8"; spf=pass (imf08.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.171 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737525571; a=rsa-sha256; cv=none; b=nwl7W9eYurphaYzhUoPa0gdnGdW6WvNkHfoD2G4huWjfoPrmBQEBINZJKtMpEJ1CyY3UrW wRjOh0cKBsgOYx6WHMAQmwnIx5K8FxG7K/OPfO0q+r3G8t8H10SHBSQFZ6SFaooCikPsFD 2I6k/19Bz/l40Z8mEzYxlNJ0rIZmIo0= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21680814d42so106110145ad.2 for ; Tue, 21 Jan 2025 21:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737525570; x=1738130370; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RlO1kRVQLX8+VpLXbuNkwAyTGyYAX3nxybEwBuf8gq8=; b=dQp/lPW8RpMDKYkS97INi7y1SBMM0M4NVCgzguw/0S2gh9KuJtGaX9lMphLMShxmK1 Qerjw0qS30ST5Df8nRpG0HYYHZcMjmVlmxy0XE7ZMMjO9Cj+zak2U/pLd+PMMNOyWmYe pc7vZvyCaIlM9duLStATezKHTJRwmedQGBHAM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737525570; x=1738130370; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RlO1kRVQLX8+VpLXbuNkwAyTGyYAX3nxybEwBuf8gq8=; b=mdLoAYFs43dpVGTnUBZ+ig/GQ5B35YfDckb6BGN72/tJ9iKjSLhvoYg8Il4XwCvdIO FoFwgkOJ/OflKDaIEKnB0YAjNYcpPfkjIY0smIJYwpsrWTemXmLpqrUGHSyusMlX5unm Mp3yUDM4jUTNbmckBc7AddZOdi3jjRpbL1G4TEkAde4ivmgPGdIcXvEh8eruTDLkLBgt NxSDWJxCiN10ZLqfF3+kPO9Azl1JXpDlQM/3uIqMdelYRtH9yZsVOJNK5JydxzuFP9RC 8MPL7gz0Fa8feK7kmaB0XFIbPoLcdCMibqUPG5ghGa7QWhKflSPOQ2T3beZN38tWq4CV sY+Q== X-Gm-Message-State: AOJu0Yz6SGsJEU9Gokrzhu0bV3k7i1ut0pr6M07NlPFyJjIQp5P0ENYN zti/KcOFBwCkYXpgLAplo+0mT0F7z/wXDT5GpZwrJsxjVRByEl+w4ywu4xNnOQ== X-Gm-Gg: ASbGncu/nzum8M4pygLk7kWwFoSLWfXkWOOxqpMoFLKCuMZFJ6x0TqY2beVRRk5Gf9F RH80os+FXWAVzpFsVYXNG9bZ8TACoQVevjzMe6QLSOA5kJSmDz/wcD+OSqbjbdE6ftz5ayr+pxN d2TJidgWJCyfwPOqzE2bQNOflnKJt9s4bFR2X0mK3UR4Bup5wy4R9Y8r8aWxdRtWnYSeGeva+ft oRDVd181sWWZHM2urtMqYCFwxv5tHWjR3G7osSF3zgyP+hIvwSW+IeGrj5g4DufDAIJdKIP X-Google-Smtp-Source: AGHT+IFDdKEw/ZLrD/5ATxrQr6EltWEOuPwzfWGcOrPfuy+nWB9ln8JMINNEvYbVGHeZ24N0e5vrbA== X-Received: by 2002:a17:902:f644:b0:211:8404:a957 with SMTP id d9443c01a7336-21c355f6aa9mr356031145ad.41.1737525569847; Tue, 21 Jan 2025 21:59:29 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:2902:8f0f:12b3:c251]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21d6217cd6fsm20187155ad.189.2025.01.21.21.59.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jan 2025 21:59:29 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH 5/7] zram: permit reclaim in recompression handle allocation Date: Wed, 22 Jan 2025 14:57:43 +0900 Message-ID: <20250122055831.3341175-6-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.0.rc2.279.g1de40edade-goog In-Reply-To: <20250122055831.3341175-1-senozhatsky@chromium.org> References: <20250122055831.3341175-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 002D816000E X-Stat-Signature: w6mbodzwfda795y41eqwh3u91jqpkz73 X-HE-Tag: 1737525570-713062 X-HE-Meta: U2FsdGVkX19U6wyjIEtpVrpmPWHKVvDpcnHoPrToHqbT8aD+Mqcd2OMZb3dCR96Ii/E9vvl/Go9E7QhQYkrWut/z6rzNfzgcWxGu2cqgFqyaWLw3UIdWwwX5EFY5EgoFC8lqOti9kbcYZg8UkEAqo26LuPcz+vLnfhHs1WRAQWwy6ZgZO4kfRSrcP6LgUedZNsxIdWi1+f7o65d5A04ufyKg1c8TjtPkouNZRDmdMxEKh0NDJgQA8flA49vWK363RVO7cMqp9fSFS9yzoA05r2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vack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Recompression path can now permit direct reclaim during new zs_handle allocation, because it's not atomic anymore. Signed-off-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 8029e0fe864a..faccf9923391 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2005,17 +2005,11 @@ static int recompress_slot(struct zram *zram, u32 index, struct page *page, return 0; /* - * No direct reclaim (slow path) for handle allocation and no - * re-compression attempt (unlike in zram_write_bvec()) since - * we already have stored that object in zsmalloc. If we cannot - * alloc memory for recompressed object then we bail out and - * simply keep the old (existing) object in zsmalloc. + * If we cannot alloc memory for recompressed object then we bail out + * and simply keep the old (existing) object in zsmalloc. */ handle_new = zs_malloc(zram->mem_pool, comp_len_new, - __GFP_KSWAPD_RECLAIM | - __GFP_NOWARN | - __GFP_HIGHMEM | - __GFP_MOVABLE); + GFP_NOIO | __GFP_HIGHMEM | __GFP_MOVABLE); if (IS_ERR_VALUE(handle_new)) { zcomp_stream_put(zram->comps[prio], zstrm); return PTR_ERR((void *)handle_new);