From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 268723B42DD for ; Wed, 1 Jul 2026 07:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889393; cv=none; b=elRMf8a5Yna8bNuq3Hl9dY4xdmv1kGC2oRTTmRrnfb82BIyszdXJUj96bDYHxr3wthahdqZfrZxCL80objYH7vPQmHKGEU19ewyYcyPcBp3YrCuBbgYNigcBAIuLK6QC43KTtDmbXU9bT68YqpVwu2Wi/vy0rAoZzgPRm2W87pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889393; c=relaxed/simple; bh=HAGRqxc7KIHCCdEKJ9mGxAxGOM1MdtRInQuffYvOB5I=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AE5rsmNbwWxjkW7BkdMwfQtCE26kn+GSD3NJKMT5pq7bkjAUo7oLAR4jl6kY1vDdyHMyFzrbb/kEK1g1mhp8llVD1WVrsA4SQQ2xCO6DPTak30N0IJjyLuE4T7zo6nqelPWq1PrTiWahr815v9En91gvfGd0mDnf0f7I0VJsugc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=X8zvc0Kw; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="X8zvc0Kw" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4921eed3fa2so1623845e9.0 for ; Wed, 01 Jul 2026 00:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782889388; x=1783494188; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BEOzJcjGcAIJl3Tht4vVazVfDVw0cfWuXCgpWa0S2Ng=; b=X8zvc0KwsgzjfXbOHm9pCvX7x+IwcXEsYhYcAqoG8ehDir4bg1VUpSTknZbahKjwWV EpbFU+Bsw991B5LjBUmJXNKtZfR3NmCXmu3SPNeT/GGtXVzpFm4g/ZS7YkGhAyU7yuCJ 4wd/itNz+D7TYCx1bt5LqQdRsbZrZ0waAwYAWfeRxLV16fh7U3DKbWI4VwTcsQUM35Uf gXdz9mCakGToVkR/+qBTI7hsm/XhGP7e5OckHrv6QUOcX8PUauRXQ+cJwumoER/DN1EX e7csiO3c6ReyPPu6J5+WFdk5cln3hgKkN1hP/fVCpVg+eDfeR5OM1G9ZiLu+s9Rqtz09 i3ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782889388; x=1783494188; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BEOzJcjGcAIJl3Tht4vVazVfDVw0cfWuXCgpWa0S2Ng=; b=bDcE3bUTvVlounVS94RsXA5zQZcjkYsh95CJgrf9pzqlpHj/yJeohRa0U/pl5dRH4T QJq4oPo/m+vLhTRSL700eqYptP0rQfV9oajqPaM7PHiaJvyw6o3VqzhePUAGCW2IXYtP Ti4yvgE8zx7bw99+n0QVPMkCNbBAVkjOMDJJFbMkQe10V4lR3MzA4FBY7d1TDgkE/e/o 07rtfUP2eMi3c9hDZd4BjAMZX/I4ULZK6Kh0J2X3TfuURuSQQxvIkBtCC+iCX4gWBFGD zWHH2EyBzE8HXRLdpuKBk9uWutKCtBrQCDhG/oIj+8coD1Czsz1FFjm5gVgnCC7tgxBw Pw9w== X-Forwarded-Encrypted: i=1; AFNElJ9fIQ9ErMXPH3j0rjqq5Y2yksHoWCYtd5AcbA5xgMNqQMa+An8+f/H7hbRk6pVq/m01a2UT4YYu7V+UT/w=@vger.kernel.org X-Gm-Message-State: AOJu0YynPdLIUef9yWhBgnyxcFnImbTOc48jRw8eklVd65gfrFWeQgGt dFi4Lv4lBEpHYojuKJejtLyV7H5NvftacJtD2wD97YsJK6zfDDHJ8aMh2cGoKP3wn/A= X-Gm-Gg: AfdE7ckVIC97Js5de3lWdnJgzFFsAlQwPpevrngG0xQn8f329Z3jpWIWGPlKiq7ghtq HcWb3yME7s67aUMxhuMdEaiiptS13ue8ZqZGCFscsMxasX741polRmTphaYhgq03CAtSnmopKCl D/z0dFtwD9L9kPlpVFhUxzDx+f0y044pnTPd/66eiKcnzkWW6iUtdN6xYVjk/nc6dwCH92JmlB/ gX1fZg1jnvLigqF6NDvhTYVysZYXPUKoyljibhRjZjRe9YhplBTTqa+1QieiukfKGjIj5n5x+AR 0zLSli40rfPWE16+eaMZ3LGDQ/GvuddrSyTCU1VwSGwEm94dU7jkxuEhsqwBqZxLywSgrqPcEhF UwY54ZBz4Mc9gBNrUfXYj2ZzPjRtaZ9Km5cihTNibGzMf538aYgMvMIaeU3tr53q1CJyBiLMZuZ pAbWY7SNVtze1y8P+kEn7HPFaEcckkh85lANzYi8mqWGFSoRI= X-Received: by 2002:a05:600c:3501:b0:490:d079:2919 with SMTP id 5b1f17b1804b1-493c2b4ce3cmr5715935e9.14.1782889388047; Wed, 01 Jul 2026 00:03:08 -0700 (PDT) Received: from ?IPV6:2001:a62:1403:d01:fcc2:cfc6:9af3:a0c1? ([2001:a62:1403:d01:fcc2:cfc6:9af3:a0c1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4756636cf98sm10981027f8f.22.2026.07.01.00.03.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 00:03:07 -0700 (PDT) Message-ID: <7c8f0e70-f49c-4614-af95-002fb2be11ba@suse.com> Date: Wed, 1 Jul 2026 09:03:06 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] scsi: ipr: use kmalloc() to allocate IPR dump buffer memory To: "Mike Rapoport (Microsoft)" , "Martin K. Petersen" Cc: Brian King , "James E.J. Bottomley" , Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org References: <20260630-b4-scsi-v1-0-494fb37ebe7b@kernel.org> <20260630-b4-scsi-v1-3-494fb37ebe7b@kernel.org> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260630-b4-scsi-v1-3-494fb37ebe7b@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/30/26 12:54 PM, Mike Rapoport (Microsoft) wrote: > IPR dump machinery allocates memory to save adapter's crash dump using > __get_free_page(). > > This memory can be allocated with kmalloc() as there's nothing special > about it to go directly to the page allocator. > > kmalloc() provides a better API that does not require ugly casts and > kfree() does not need to know the size of the freed object. > > Replace use of __get_free_page() with kmalloc(). > > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com > Signed-off-by: Mike Rapoport (Microsoft) > --- > drivers/scsi/ipr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c > index d207e5e81afe..5a212bfdeec2 100644 > --- a/drivers/scsi/ipr.c > +++ b/drivers/scsi/ipr.c > @@ -2893,7 +2893,7 @@ static int ipr_sdt_copy(struct ipr_ioa_cfg *ioa_cfg, > (ioa_dump->hdr.len + bytes_copied) < max_dump_size) { > if (ioa_dump->page_offset >= PAGE_SIZE || > ioa_dump->page_offset == 0) { > - page = (__be32 *)__get_free_page(GFP_ATOMIC); > + page = kmalloc(PAGE_SIZE, GFP_ATOMIC); > > if (!page) { > ipr_trace; > @@ -3226,7 +3226,7 @@ static void ipr_release_dump(struct kref *kref) > spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); > > for (i = 0; i < dump->ioa_dump.next_page_index; i++) > - free_page((unsigned long) dump->ioa_dump.ioa_data[i]); > + kfree(dump->ioa_dump.ioa_data[i]); > > vfree(dump->ioa_dump.ioa_data); > kfree(dump); > I _think_ we can replace this with kvmalloc, and allocate the entire dump buffer in one go. Once switched to kmalloc() it's kinda pointless to allocate separate page-sized buffers here. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.com +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich