From mboxrd@z Thu Jan 1 00:00:00 1970 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 77E36C636CC for ; Wed, 15 Feb 2023 12:23:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06DCC6B0074; Wed, 15 Feb 2023 07:23:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 01DB26B0075; Wed, 15 Feb 2023 07:23:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E28486B0078; Wed, 15 Feb 2023 07:23:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D22396B0074 for ; Wed, 15 Feb 2023 07:23:47 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A337FC0B28 for ; Wed, 15 Feb 2023 12:23:47 +0000 (UTC) X-FDA: 80469442494.01.524355A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 3928020005 for ; Wed, 15 Feb 2023 12:23:45 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="YazD/LF9"; spf=pass (imf03.hostedemail.com: domain of mpatocka@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mpatocka@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676463825; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=l3Cz4qPfh6SVniqMxzACvEnXSN4Vm6rhHNCN0GEcnwU=; b=yxrFbRQxguNWNQdTJmg612FLb2KjL2rj3FRpruS5ez71I2RpZxaJ3k+BnD7ey2Xca6Huj/ usGrfHKbauAA+aiNw+3CxQXNK6SflX11wP9sar067hYF3vvW6mzmwlcu0BQv8ScF2uYPyj oLNJm8RJWZRsU4Wo43cky9S7gN1q1KA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="YazD/LF9"; spf=pass (imf03.hostedemail.com: domain of mpatocka@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mpatocka@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676463825; a=rsa-sha256; cv=none; b=Sfqv8ARoUpBQsO78GmIMwsgJ3IASnbt45NGmIcrOF3teusxdQ9qlnArJmyXMnbqxStA+/j uFixm8DYILz+8Fq48wzkMrWCCtavfxQZCrtySmybFaSPcx/i1deDsR7RP/AlVgxWrtLT9x vDU7TM0pbEyeVYRtYZ1bdIG+FN3wiWs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676463824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l3Cz4qPfh6SVniqMxzACvEnXSN4Vm6rhHNCN0GEcnwU=; b=YazD/LF9oZRI7aSHmzHd66U5pLgObELtETLAbD94kksWX30Ek4ex4uDzoDoNsnm3sAzsuj QqvKACo9KWBez9XSLkf+qxIGgvQLDSN8qCJEvdgaAP3NHXs1P6lQhJA53DoBrWMJMdVUMv a7J0KI4sMcuQFVJPH9BiPm8RzBeb6lQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-VLzuZdXQN8OcPjdgrnXQkg-1; Wed, 15 Feb 2023 07:23:39 -0500 X-MC-Unique: VLzuZdXQN8OcPjdgrnXQkg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71C503847980; Wed, 15 Feb 2023 12:23:38 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E0C7492B0E; Wed, 15 Feb 2023 12:23:38 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 31FCNcAQ007819; Wed, 15 Feb 2023 07:23:38 -0500 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 31FCNbeX007815; Wed, 15 Feb 2023 07:23:37 -0500 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 15 Feb 2023 07:23:37 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Yang Shi cc: mgorman@techsingularity.net, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, akpm@linux-foundation.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [dm-devel] [v2 PATCH 0/5] Introduce mempool pages bulk allocator and use it in dm-crypt In-Reply-To: <20230214190221.1156876-1-shy828301@gmail.com> Message-ID: References: <20230214190221.1156876-1-shy828301@gmail.com> User-Agent: Alpine 2.21 (LRH 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Queue-Id: 3928020005 X-Stat-Signature: m5fiktiinzhff4i4z75cggay9sia567p X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676463825-25868 X-HE-Meta: U2FsdGVkX1+MamDT2LuFaf/ot3Uscvp80hJ21fiHne6vLGQhnahtOflYE8IZSjzm+LY5llngFQbz2oLNrj5jBGcRDo6b18Bh8QFmr/qNKbuDHpgQMcMAMUuwmcRPAVYhAYsszIdWPO5EENMBxr6AmX6JN442S/jy/5pjrbOoCWrGtIJ5Q0LJKexGkyde39DKjFkFz/Uz8ejaO8qELaDETTE1SVy5b6s/1ATJR7NokfpHe31457nDMFmD6IWv7yaeIuRNwxz4Y1LswsOO9F/7bH7bfgCpFCn72NModSM5S506R5BqUTWrnRdLn0ooc6eiq2ERjgceyDi8USHQ43E6yGozCtEs8EdqqLSAjVKqFo296p3uswGFg3oe3gSWm3t1m5Bm/YXuI8AygZQKXS1M0rjduK7pxjYEwbY5LcifHKrQSmG4jFYKDX/8UgqrqN0jCMlROB8IlTVANBresIw50+27xXdNHtABVXd+U+RmEJxPYG3pJMwuzsxYy7ns3wCqp+dTGQQWU2zihldnzGFvj5EaAMJYRP8TWYt0BAqtcJgsaEO1hry2wqYXk3CAkwZVR3kVWmeX78jSy9eRXnI70AlrgYiFQ7YitHD2n0AuuxT7UNWbvj6e9ka+YTUSrc34Qup62LpYr/wKZQ+H6d05MUXxYQloJfCLqgmYQW5e0o4C9Sy7uFMPV327N1wOQ2dnqCzZYI3rjUWsAc30TODMo8q9h72N7Qaw3T9qcTL4lwJUzsewobQuBfhLZVYjwd3gF522h4WPwmBy6SaOAhxIMSAehFw+3oQFhRGRWXyyUWTQfanWB2GL4nFA0D0CREnhWkavZDnd/PUoy/gUlegW6sVeTg5uDltc10hGbg0ZSJNwmDqh2d075JD1qf5TjQnqe/DSBT5jpVyVB+QMjp7nPB0obUzhY5gBjx23FyZmMKXPsIvVwHlXu7fKnBprrvEM9QFsPXrppQeLskuo1Uc aBWcM2TY Zfs8fu7tlEUjMwQ5JJ38HkaxLxJxKK95mqt7BJA7gH3eee4ktgDauya+GxhwgPz7GirCnxk5reJcKuyhvOaxYht97GXC7VAvl/gs4VkroD+MGYHK8T2e6loJ0FVrzpDGV/0djieTqouy2QjyXGPUFI00D2mCkZUEa8+rTuj/ko8x1V2nTEkdN1jTTzQJTQnypq3aodJKscQ9iOtTFPrzGBCb/yuxNhi4a4uEOVV+3TC41I9xXUprRB/K9TeXxlxghqpcWilOjqaTFGTgeOP7zOvmc6M6JWjr6H1E6 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: On Tue, 14 Feb 2023, Yang Shi wrote: > > Changelog: > RFC -> v2: > * Added callback variant for page bulk allocator and mempool bulk allocator > per Mel Gorman. > * Used the callback version in dm-crypt driver. > * Some code cleanup and refactor to reduce duplicate code. > > rfc: https://lore.kernel.org/linux-mm/20221005180341.1738796-1-shy828301@gmail.com/ Hi This seems like unneeded complication to me. We have alloc_pages(), it can allocate multiple pages efficiently, so why not use it? I suggest to modify crypt_alloc_buffer() to use alloc_pages() and if alloc_pages() fails (either because the system is low on memory or because memory is too fragmented), fall back to the existing code that does mempool_alloc(). Mikulas