From patchwork Thu Jan 30 11:10:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13954485 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 315FEC0218A for ; Thu, 30 Jan 2025 11:11:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDA936B00E3; Thu, 30 Jan 2025 06:11:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3C616B00E5; Thu, 30 Jan 2025 06:11:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B6506B00E7; Thu, 30 Jan 2025 06:11:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 720046B00E3 for ; Thu, 30 Jan 2025 06:11:50 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 34A541A0CC8 for ; Thu, 30 Jan 2025 11:11:50 +0000 (UTC) X-FDA: 83063853180.07.C573474 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf12.hostedemail.com (Postfix) with ESMTP id 4A6AF40010 for ; Thu, 30 Jan 2025 11:11:48 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aTHsqPi6; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf12.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738235508; a=rsa-sha256; cv=none; b=ugNJ0DkVtd59UG/2cioMEeYAcYXVHccZFUeLFGC7Ad+wKpdrDDVwI99ggZiiQP11nxAoS0 /CUjDl6y2+ubAuvztqYEAQu6ZeUFRvKujv9apex3bMymaCTBWjo7zrEY6IN11+Q+SCz/2r ycmvCk/rgkf5vyxFZ5pf7++/S+p+mNs= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aTHsqPi6; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf12.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.170 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738235508; 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=wsNyTVEtqJeOeaUMXY3SZH4okPEwKCuL4AyQgcINZOs=; b=iyHE1slkLBLc2coNYKUTcUrfY0+whe7xxWKHyhSLiuTIw27fDFGfjzWlISLBsb/ckquQAI RDFLnb3zy6D4P201InOkJlRrCSScWR7CH5s0A3MzkaIa1BQqfow+Aaoyq1ueL37Vqqm1kP uvlZ5QWcJ8/4nyX7BQcqc8rtxW6rlN8= Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2164b662090so11611655ad.1 for ; Thu, 30 Jan 2025 03:11:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1738235507; x=1738840307; 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=wsNyTVEtqJeOeaUMXY3SZH4okPEwKCuL4AyQgcINZOs=; b=aTHsqPi6U1Y+IZSxfuRyZrquQBKaJQs+/VtxvcpPW5V/J7vdo9uuShFGnf0sWuhmmO YsRyAyUD4pw1VFKlJEbZvn4GviCYcb6cuOOvAfQr9WBluRBJ0hNE3MLENTeKzHWAyejt FzYwImUEOPWRxmPqJ1gTnVDad0319CgbJTp9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738235507; x=1738840307; 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=wsNyTVEtqJeOeaUMXY3SZH4okPEwKCuL4AyQgcINZOs=; b=ZIvEepgfIfwDq4Ty09v2aVzEPZn3bhNsEjIqoxfuZ/rrFrrQoCCanhgeNSE1nvVtsM o3PQ123Y1/2yGC8uOz5qvfP0k/u3cFT/HRiFKrzKoUns8NSD/GK77DE8O306kYBxCirD x/ZEHN2afhRI/ndeu4EwBAYrJde0gFF7kG3eBkGWYvfG2WvBTaz1aROpZwClZyfW+GB4 3JsxXGVWafaQLms4hWlEIyJ1mhNJLX/UBC9LMrow50o81aPO0t4dl91spr3/mzZMd7IW hcneIo2BCHNZDZRgDFSEMBWjXtogjyV4nqjs4jwLzWdQkrjRaBUaPUJ8Lj3IraD3CVKS ICHg== X-Forwarded-Encrypted: i=1; AJvYcCUZDl+L4/Da2Kt9E5UsABdHXfvED+8GznOsGlklv26EaEfx+swTF3om9cbTINvgA6jMlMelJcbPzg==@kvack.org X-Gm-Message-State: AOJu0YylM3iNWRVKyWgvwgb7F5b98tUh2thj3nTvka3HhdgBDMrPR2Lb BdUiZC2Nvx/9/MYspcYQlea1D+Qbopz8skw4gMVzB/aYxEXKx+qnBWOfTIaZBQ== X-Gm-Gg: ASbGnct64am1Q7rj8m/nh6fRNy0/8Mk+K3OKxyx0gATbgYuCU54wWByThtMFBFlk5Al 8dE/qdjqHMdeMpbabkQAeYuyy0gvmYpx/PxZ+fTEISCPJ/NgGqnCPlO4lHHG6Whr8bRErnldweA lVHY/PjfZdAk3MlRVf5TYkHtf/9cniYeLbntxSdqrjc5sTRAPWuN26cYnTlleJmdDWMFNG6Q2ZC oGFSl5DXYGlgNCSurHfQ9A3QXV5q/7/cWRkZ5e7O+6X2gjRb3LuoRtSwpqunt0QhQ7GOHXjnpc9 vnGeL3ZkQpiTG2xv X-Google-Smtp-Source: AGHT+IGkwzFoDqvhfsm5VPosd4bbEzVRTQxGnDnsn5b9Avd6d9LNbqhCO+f9O1miDGFRqxuRGkD6PA== X-Received: by 2002:a05:6a00:2448:b0:729:a31:892d with SMTP id d2e1a72fcca58-72fd0be5470mr11033309b3a.8.1738235507138; Thu, 30 Jan 2025 03:11:47 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:d4ce:e744:f46b:4fb]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-72fe653fe6fsm1164789b3a.80.2025.01.30.03.11.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jan 2025 03:11:46 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv3 07/11] zram: permit reclaim in recompression handle allocation Date: Thu, 30 Jan 2025 20:10:52 +0900 Message-ID: <20250130111105.2861324-8-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog In-Reply-To: <20250130111105.2861324-1-senozhatsky@chromium.org> References: <20250130111105.2861324-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4A6AF40010 X-Stat-Signature: 1cnyhtfuq4ap94ugywignshgcpob8gwk X-HE-Tag: 1738235508-185092 X-HE-Meta: U2FsdGVkX1/Q/Mth/IJUrYOEsf4duSOSWl0WN/T261y4LuEtaa+WOco9T9DcX3sBukJyZMpXQjEH0kXMe31mgW44SfAstxDBiIRNphyBoqFwAhm60OLDTqFj6Rvo3kv9YH8usKPX+0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d3e2Wz9GYTu7F3TBBXG4N18BwMFJTSlr5ixJHq+gYF/xrcuauzuA3qvjO/Pw/9+w28N6nCOQe7ediXxWgbFlthRY9/mNig== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.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 28e5b02dc3a1..ac8b4f47a496 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1981,17 +1981,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);