From patchwork Mon Jan 27 07:29:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13951027 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 B0B39C0218C for ; Mon, 27 Jan 2025 07:30:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E3CE280127; Mon, 27 Jan 2025 02:30:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 392062800DA; Mon, 27 Jan 2025 02:30:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 259BF280127; Mon, 27 Jan 2025 02:30:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 03CA22800DA for ; Mon, 27 Jan 2025 02:30:18 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BB06A1C9BB1 for ; Mon, 27 Jan 2025 07:30:18 +0000 (UTC) X-FDA: 83052408516.18.F4C0C31 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf29.hostedemail.com (Postfix) with ESMTP id E0BEE120007 for ; Mon, 27 Jan 2025 07:30:16 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ZhXlukGP; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf29.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.49 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737963017; a=rsa-sha256; cv=none; b=emZLRaHGtIbkZx3QHEJCRDCM53U3ObFBsjkKnajf8NBn2v6yO2V+z/TtXtZjCeJP//WbV9 mtNY1GLO6uIlJXCcBN2OMEl52fA2Ug4UIH93fXQW8I5QSkKYVpb4GyNowiRIppaIpzGgPg HeSpYt5BWUp9GaaTh/39LP+XR1x6/Fc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=ZhXlukGP; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf29.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.49 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=1737963017; 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=eEuN8Bq5p1mqZ6qTtfa1iRJPgB+Yv5kUdAyDKcVHFeU=; b=k5OhwCjswH/bOxb8mnFcpx5+3rLCHuMZmvZrElEEG8z9eg/9/TD4TakQG0IGghYhuXd1kx XXnue54pQvnGKVgVETnn4vBFBYtQj8tbdBvuzUb+Dy6xShEmybzt97j/HweHKOlpv9bUKH 4GBLoZBsXdq7c/5+Ig5xPeL9Re4pz4E= Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2ef70c7efa5so5601710a91.2 for ; Sun, 26 Jan 2025 23:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737963016; x=1738567816; 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=eEuN8Bq5p1mqZ6qTtfa1iRJPgB+Yv5kUdAyDKcVHFeU=; b=ZhXlukGPBpGTnCOD0mU92LWFp/ytN+HYeWHeREAjclbQMnA6xrVGifcTA7wPOYkVtg vc2II+Of7AlmGeTpZ5+MAg3VduuCm7Xi2BEjWoMlGPQbc6frCZIJjv75UNoRVQ1ke56G XCtV1x/OxaE2Cs8sGvOJTtsDYoSuJTM1mg62I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737963016; x=1738567816; 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=eEuN8Bq5p1mqZ6qTtfa1iRJPgB+Yv5kUdAyDKcVHFeU=; b=AXhCgdGP1B+P3kGa0GwqPkvyg70D26ZCr/O5W5PK/NFMUtgy3g2KAGMcUrzue8a14J tQqBJM7zqSlJTgpX/Y2Px8YbGUsOn8D5PvT9UVr/gCeaDhqLzl77cOBhW9ecs//VOW0d JF4IkDkZyy+4SU6B6JFQF20JpldqTiNzGLbBEsjKix9/6hqMkMTY/S1DLLdPraWSrsCC fZdMbdCc5Qwek96JmTBzkXDOK0nXS9i6x/PBPHvP8Ct/MNopqrb2x+nXAdagHC3GmylB 41ok5ueMbjYGeZOjG3e6Ow6WAYWoEJ8CzcYd2hM/IGpC+1N8It72rcWGe41wIr2aKjnf MUdA== X-Gm-Message-State: AOJu0Yz/U+lTJo39a08otwXgsNbfC3pwx94P2pCeKpNLvPaPcmj35puZ q+NZPZ0nKETxTkQrrvuuVPMTdE9TuXvE7vAULrcPmmLInmyd8/n75HCPg5VjfQ== X-Gm-Gg: ASbGncsJAIIxE0dshrpX6/btQ43R/YRZzym1WQnzASPqhkjiJzwxkzOCvYOcywRLFyD pKLK4Rhm4PoaejHTelzxx94NdiMkfTOjQcZENyQKFpxh3OyNuRODk9fMRLiAFgGery+3jDqoEEF okeHfZqbJjiOiTndFrQoY4MRL+lfxwMA0tUTpXukkfygEhhvSVcdeN8q9DEPwb3+lKXHTB6I1ZS Wd3k3g6ddWtVLcnroAV8G0Ds6pWJVUGRdhREEHZpaHaL9nZ9Dl+vjURp7ZTFQbm0kuqQwng5Nkq nsy1h8E= X-Google-Smtp-Source: AGHT+IGlo/vTdElSIeoYoZL5xyWIf44NgB7/wcjQQDIBMbG82N6RjyywPPzveq1A/4IFqrAaMweY1g== X-Received: by 2002:a17:90b:5249:b0:2ee:e518:c1cb with SMTP id 98e67ed59e1d1-2f782c4bdd2mr61051697a91.7.1737963015607; Sun, 26 Jan 2025 23:30:15 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:566d:6152:c049:8d3a]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2f7ffa6a755sm7123997a91.26.2025.01.26.23.30.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 23:30:15 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 7/9] zram: permit reclaim in recompression handle allocation Date: Mon, 27 Jan 2025 16:29:18 +0900 Message-ID: <20250127072932.1289973-8-senozhatsky@chromium.org> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog In-Reply-To: <20250127072932.1289973-1-senozhatsky@chromium.org> References: <20250127072932.1289973-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E0BEE120007 X-Stat-Signature: yp6a3h9cjutqj73xpm5u7pux14h1qout X-HE-Tag: 1737963016-680993 X-HE-Meta: U2FsdGVkX19XCxne+Djg35xykPuGjqfaPXvprcyZjtTx3AXksYznVRAKbcb63amW9EjIxX71lvs1h8XFEszzeNm4wnUWFoJjHTMkkEuuRLCCqLKsonZOljKBLNhvvuxcgY5GA/vrU2Q7LIi0UDwAcWsR01O6jPEIYDIvSXi/yicFx5mtt++2ejMH6vhdyEWOedCkVVsJhvg6yJQNPFeSTCsiXlfpXlXF+lFZXHQGmeiVoswUn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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 046c80aa4310..10e4c6a7735c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1988,17 +1988,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);