From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5778E2E6CA8 for ; Tue, 23 Dec 2025 05:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766467809; cv=none; b=cUU2RmOrZnG0VCdIWtPB5Bi5SSAQNEtbZxpAhFPPJkJz3TTW2l2fgzeMufU2En7YBSB+blo20cdPT4JleBcgR8whC244+C9qhSQw5QsF22GWGB2Y40uYYivzQRdbWcfc64Bb6LRM6/i8oG2zQHIT0SNPVmetC8UPdMec4XLrBww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766467809; c=relaxed/simple; bh=LeHgaTCg3sZgaNtwPEbjvh+7JlJOUXsNXjaOCgEgLN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jn6UzUXfUTOJevhywqV9OeZuF0eK4OEzQLNSElup9hlnlMhjGDzHf2tmMFK1I95NAQau/qJZik8U+Lca9jfQo9QK4gxz52xUgwt3l9ZSV9LVZmpctgVu4einNMv9MSFjX2/PJpOEd3xhVrY600FojGDBr0AMs3/jWOH5kgazp7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UOxfjcd3; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UOxfjcd3" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5959d9a8eceso5334006e87.3 for ; Mon, 22 Dec 2025 21:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766467804; x=1767072604; darn=vger.kernel.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=CjrVs5qAijx5UEiplGDR4bSOktnBgAEK/U0XoVs0/GM=; b=UOxfjcd3KLs0/zOnrEFXM55BIWgg4SWi7QASfMBxTSTBULhPeHWEyu9QQ41IsMHxJv Vp4J37vnn0MbCyyHvtoKWrrB5NPN16zaVrihzDqnjfnlEOIzQDiHn/X+3VkweluQlVpb b33rHk/R0YoujjZ2Dpv0aI1Upgc7yZ4hOw6Cmv/tLdRxRvhKexEtFEhctSH60l90r/Zd xlN0HuUDA8htT+yqvZR6jTx5OHYZZeMVU89zHBe7m9K23LD9P14tIhWQdD0HfBvxOzCG taDipDYZVRZsaI4qpACS606KN+Rw6yCh/03YJoxxr656Fng2iSGKjgipon8b0miprEbc BsDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766467804; x=1767072604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CjrVs5qAijx5UEiplGDR4bSOktnBgAEK/U0XoVs0/GM=; b=TAahyBjvxvlgh1e4L9Iy79edfliEBtLvVNMH82+TRGXzYgockRVKQ6/7y6dT7i7Jti 7nTyx/+fGtTDRHjnazEaNkV4rsaKSM32smEtqit68K9igoYXIlZ5RK8AyuIHiB+qgfqd 17JofcbbxXr33hooPfA1Hl65wwVkX/40j7B7UjJFIKRJdl5cfGPIYJzRtHqApxCxaO6I ukpY8AewMEJQuxIyaUfnUTJbL7c0V7eTFdrRG6A2HinmHHgVRNt+WGF/EK3/HxDBG/u3 fJu+5SAu/p6Fc5GpwYJoQ+2HUaeVS77Awak5SvekytFjH5dqzejOEzh+vQ/i6gM50W8p ZBaA== X-Forwarded-Encrypted: i=1; AJvYcCXkqUBmKkX5Vn3FVMsdId/QON6CdXTEXgAEFnWhw81AUgHSlZr3cZPd+0+etCLNTGpsTe/XPr3Z9zLD@vger.kernel.org X-Gm-Message-State: AOJu0YxmH9ngB1roOTr2LD/xZZR0gHsyCvumTLloZnTPl9P/kcNhHnKC +bHfad4WN+mZPdcvukConAxx6u5AINskD0HFkr2nMJn1Jcn+LMMm1sz8 X-Gm-Gg: AY/fxX5wpbLslDExS6y5U2YbA6IitIBvcjWXS1t6Ri9Ceg7JdPgNWigjdAUvnRzlkXE 3l4IfA8rutMxGZJ2XwTEVqYrmVktL4c5rkaiPTvudqS14MO64CjJ9db0giJH4H6iFvn/RnQ4lSg UV307prNaHpTQw2X72CswS4DziJ7+usWYjrR5PtJxiKcOcRAnEOyZYY6zM9jzSi7ulB/1X8xAxJ obFOETa6FRJ25UDyXEPKKNlJ2nDjEPxj95KaahOMnCnXEr4PiI4wUpwz19z4xLELavuiNiQptvM UiHUxnlG3Au8+GAAh9s5bPk3d3+bilopFPJ3QQy7gL2Es66V/HV1cffxG4oFtzqL/snK5abAgiJ vbk2OHKe6PIQGQfnHsYmhztYjln7g/2rXNP9Gfuhts7RSzJtVGUftiVRSbR314DUC9PSbKn6qyP IgjSVeAO5e X-Google-Smtp-Source: AGHT+IFBJ4czf5dy7NoHG6Z5fLR0sF8QwzLoI7Shb3fIF5XKnuFbQtFm8MSKsqZe2birAQ3bGk4BUg== X-Received: by 2002:a05:6512:3a85:b0:598:8f90:eff5 with SMTP id 2adb3069b0e04-59a17df6969mr4474213e87.53.1766467803957; Mon, 22 Dec 2025 21:30:03 -0800 (PST) Received: from localhost ([194.190.17.114]) by smtp.gmail.com with UTF8SMTPSA id 2adb3069b0e04-59a18618ce8sm3818747e87.54.2025.12.22.21.30.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Dec 2025 21:30:02 -0800 (PST) From: Askar Safin To: gmazyland@gmail.com Cc: Dell.Client.Kernel@dell.com, dm-devel@lists.linux.dev, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-crypto@vger.kernel.org, linux-lvm@lists.linux.dev, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-raid@vger.kernel.org, lvm-devel@lists.linux.dev, mpatocka@redhat.com, pavel@ucw.cz, rafael@kernel.org Subject: Re: [RFC PATCH 2/2] swsusp: make it possible to hibernate to device mapper devices Date: Tue, 23 Dec 2025 08:29:52 +0300 Message-ID: <20251223052952.2623971-1-safinaskar@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <86300955-72e4-42d5-892d-f49bdf14441e@gmail.com> References: <86300955-72e4-42d5-892d-f49bdf14441e@gmail.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Milan Broz : > Anyway, my understanding is that all device-mapper targets use mempools, > which should ensure that they can process even under memory pressure. I used journal mode so far, but, as well as I understand, direct mode is okay for my use case. Okay, I spent some time carefully reading dm-integrity source code. I have read v6.12.48, because this is kernel I use. And I conclude that dm-integrity code never allocate (not even from mempool)... ...in main code paths (as opposed to initialization code paths)... ...in direct ('D') mode... ...if I/O doesn't fail and checksums match. (As I said in previous letter, mempools are bad, too, as well as I understand.) I found exactly one place, where we seem to allocate in main code path: https://elixir.bootlin.com/linux/v6.12.48/source/drivers/md/dm-integrity.c#L1789 (i. e. these two kmalloc's). But I think this okay, because: - we pass GFP_NOIO, so, as well as I understand, this should not lead to recursion - we pass __GFP_NORETRY, so, as well as I understand, we will not block in this kmalloc for too much time - we gracefully handle possible failure Other strange place I found is this: https://elixir.bootlin.com/linux/v6.12.48/source/drivers/md/dm-integrity.c#L1704 . But I think this is okay, because: - integrity_recheck is only ever called from here: https://elixir.bootlin.com/linux/v6.12.48/source/drivers/md/dm-integrity.c#L1857 - that integrity_recheck call is only ever happens if dm_integrity_rw_tag failed - as well as I understand, dm_integrity_rw_tag can only fail if we got actual I/O error or checksum mismatch So, this mempool_alloc call is okay for my use case. So: in 'D' mode everything should be okay for my use case. Another note: I used very stupid way to search functions, which allocate: if function has "alloc" in its name, then I consider it allocating. :) And final note: there is an elephant in a room: bufio. As well as I understand, when pages are swapped in my use case, they first will get to dm-integrity bufio cache, and only after that, they will actually hit disk. This, of course, defeats whole purpose of swap. And possibly can lead to deadlocks. Is there a way to disable bufio? Or maybe bufio is used for checksums and metadata only? -- Askar Safin