From patchwork Wed Dec 18 06:34:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13913083 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 499E5E77187 for ; Wed, 18 Dec 2024 06:35:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32656B0082; Wed, 18 Dec 2024 01:35:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CE31E6B0083; Wed, 18 Dec 2024 01:35:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD10B6B0085; Wed, 18 Dec 2024 01:35:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9FD136B0082 for ; Wed, 18 Dec 2024 01:35:21 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3F8D544563 for ; Wed, 18 Dec 2024 06:35:21 +0000 (UTC) X-FDA: 82907117286.15.B9F3BCE Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf12.hostedemail.com (Postfix) with ESMTP id 9FFCF4000F for ; Wed, 18 Dec 2024 06:35:05 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ca9vwV2k; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf12.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.173 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734503704; a=rsa-sha256; cv=none; b=58JQyud27jBce7JqCmY8PIJomrz/wEvsyASomvb5/U1HOfnOX9ifNUElHPHKwtQJoYlZbr ddi3TlmylVbcyY7srjFBkWb/b9b7If3062t+/TBZZV/CnZ950ST7a6aTZrHKp7JZFv+B+X IRMa1mwivMoVmFlDGA9GGNAQKBBcNpo= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ca9vwV2k; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf12.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.173 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=1734503704; 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:references:dkim-signature; bh=88EMhL/BvYCq3LIz+Wss6+9eNb0sySXt9c8EUZP0CjU=; b=oobty5WqEOcqU6MZfyecyWRRh9OVA2Rqb4bWmHFRWAbFldw/Q5dmbWwTSa7FWw2/7t71zm Ty2Qe7g5BXmtfAOBsuRs+yxgGzxZk3JnewYJHvMFBFDYfNzc0eZmoORizdFVNqz91L8le6 GP+TbcIx85jAmL8nKCQb5Qqycay7t/M= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-72739105e02so6658961b3a.0 for ; Tue, 17 Dec 2024 22:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734503718; x=1735108518; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=88EMhL/BvYCq3LIz+Wss6+9eNb0sySXt9c8EUZP0CjU=; b=Ca9vwV2kD+Kg0V5mmQv8ywMx9lYTjkT2ljgzvhZwIAogNociYL30CG8NPuVUTumgK/ KcBcJ1RwU5qxrU/xAAwcr395AmQyZl8jG5uZJ5Ne4LxmKdta+McLw+gX37QP1UpGaudw SMPaRZ7zBYiAWzR9eshz7gytd1NIFQstQQBXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734503718; x=1735108518; 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=88EMhL/BvYCq3LIz+Wss6+9eNb0sySXt9c8EUZP0CjU=; b=wVcw13oBymwtyFWDycv4ZXvSK8ghcwErY00M/v8AvjZXg4gYUujpqZL63l7ZfBLGtX UyBXZcv1Rm0QDQxAPPLgrkGOSGR8Fiqt+2iNL0kE2XhjUbUxdKZ9C9Lv5z34lq7TnQR/ zcHfxhclXXzuqq2CFiR87V0ggH71JWxysll6bHKdyrM6gTvKK5dcmTT6xkiFEaUS7ruX /7WL9dCrUuPnkJLLFxiJCX7b+k7zopxewinjnh+vpGrkGuXy+LXERLGZNPVeNFi8j2tT GmS/nG2/zAHvWeOcqf3oPPsx6exkBpPydFIgSHtDVqD3TcVE+fer1IR+IFne3ZUevq47 8NhQ== X-Forwarded-Encrypted: i=1; AJvYcCWWlpI80s3JLTRFUULbIIwIU7YJmxT46HHRlzyUaMe38liOEeVTp2Cfrf/R47pmCzJQjdqpa+XykA==@kvack.org X-Gm-Message-State: AOJu0YwXPKhRmowqH3omsm14hpSkikidalYGvZ/ll4ulA2ZHL0Mxhel2 H9WnCUzcafpiwx+o8UfURJ9lHY3uKedYQ+dfZZx6ds5x4BcEaHNHci8vVs+jSQ== X-Gm-Gg: ASbGncstIyqT0WpDmtUcge52ykl2eVuxLtAwEXaXqV/A5AyhU2CCuBg0vLjAyK4Lxxn Vv2B++SM/Tp7SyNFatsvP52t/PdX5BFJYTph8m87plnQX6RXqd8SvNNqLkVOR1AW0DUI0L/o+9R u+uh9jkwjLTzZ/czV8WtPUvBJwEyCMOtgA2eKpRM9Ni21zwd97Y/etmeg2c60roks/NDOREJkza geR8de9g5j/TSpMXTvj3rb3NWwkKRtuj6DCs9AefidPSOml65XR6G558lM= X-Google-Smtp-Source: AGHT+IEB5GYXe3eW31sY7OiZOs8TGmH14LpDC/0ghmAmlnWVjCaJcCcdgf1LkIgFUUtfKpNF5+4Rgg== X-Received: by 2002:a05:6a21:8dc9:b0:1e1:e2d9:7f3b with SMTP id adf61e73a8af0-1e5b48b9884mr3706260637.38.1734503718038; Tue, 17 Dec 2024 22:35:18 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:3bcc:36cc:b9fe:9379]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-72918bae6e0sm7744712b3a.165.2024.12.17.22.35.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Dec 2024 22:35:17 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 0/7] zram: split page type read/write handling Date: Wed, 18 Dec 2024 15:34:17 +0900 Message-ID: <20241218063513.297475-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9FFCF4000F X-Stat-Signature: exjzmp5zmer8rfqc3qzkangpathm59zh X-HE-Tag: 1734503705-713564 X-HE-Meta: U2FsdGVkX1+3cLLpxrJ/QfJksYUxduXf/dRl1SGxoqkHYRy2DlyXpTcePitsIqUWDdRBbER39/hxgArQcFLVuLAzizL7wMycy87Z1jaKfO7xFLRHLlyCQGOgqeMeBjxahp4tk6Gr4TpYiOWqQjY7tlFHNmNMMDWJMrEY4nPfKk+rkTKRjw/U5dIXw5I9YVGsvJdwQx/AjSnuedafCF1cE/8r++d6weVnmbem910kDnZQTDgboQilitfunbgFYFXvrro18/kXd0mGkkGdqHpYfiRfkPbVSlvTdi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k X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a subset of [1] series which contains only fixes and improvements (no new features, as ZRAM_HUGE split is still under consideration). The motivation for factoring out is that zram_write_page() gets more and more complex all the time, because it tries to handle too many scenarios: ZRAM_SAME store, ZRAM_HUGE store, compress page store with zs_malloc allocation slowpath and conditional recompression, etc. Factor those out and make things easier to handle. Addition of cond_resched() is simply a fix, I can trigger watchdog from zram writeback(). And early slot free is just a reasonable thing to do. [1] https://lore.kernel.org/linux-kernel/20241119072057.3440039-1-senozhatsky@chromium.org Sergey Senozhatsky (7): zram: free slot memory early during write zram: remove entry element member zram: factor out ZRAM_SAME write zram: factor out ZRAM_HUGE write zram: factor out different page types read zram: use zram_read_from_zspool() in writeback zram: cond_resched() in writeback loop drivers/block/zram/zram_drv.c | 301 +++++++++++++++++++--------------- drivers/block/zram/zram_drv.h | 5 +- 2 files changed, 171 insertions(+), 135 deletions(-) --- 2.47.1.613.gc27f4b7a9f-goog