From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 1D8B435AC07 for ; Wed, 1 Jul 2026 07:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889472; cv=none; b=YQmQGU/3yD0ZaLbuWtg/RDKumKXpE7u/TOhjm+mauL6NN5tnHJBri4WdXP7HzJdp8QGeNKHaedtlab5YEzbemVNvB4uDAjsqid44wEsUMkORjREsLNpT42eLTU7kTq23qXsECvLwCegCHBFCW+Ica0+Q+fqDJDN2XK7rXDizHEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889472; c=relaxed/simple; bh=M+tlOieiqe9VTehuccEv9JoE5ofZu5aY/gM7zDk/je4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ol6mfDEgGewjyIpgGOkW4DNtg7DZAb4dQJCYpvBTAVA4gSWhE07GAbfpp8wEw94RwYELSMtKAw+EfBR9iMV4pnkxg7FkzqPxlmrzMis2m5tAY9N0xDunupZ8DZi72VlGE3+GW9toX9PwgBcS3yIJgFHeGdLOqdHkZ3VZHJSp7RE= 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=Tgpm88SZ; arc=none smtp.client-ip=209.85.128.53 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="Tgpm88SZ" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4939a809b24so2785675e9.1 for ; Wed, 01 Jul 2026 00:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782889469; x=1783494269; 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=Frs6Emcy9pNNZIaepK2NrL0xBcYA3u3r9RRnho4i+Lk=; b=Tgpm88SZxcQ9vs/VsZOBTMWg8ElYQa/aAlokRHI6+IIaQU1NFjen0BNUzKUhjpMUbe mYs/WJaFks+9dbvwDK4PFiRrscuNOODhvAfAWSukgoZEIFZhnc3wn0SiFU98wBxHUggF XLOtsejM4j9AuVzmKKaUUxOBkyYSi55NPr3pJ8ApPGPo+dUKZQEZeAhBo0ubgEDuUHo3 TNEBd+FrwUHXRu2wfOv/WgMqN7XOqxor9a9xDNMX9JdscVoxDxjkGWfhaoMHSKCGfHmv yb9gmt3NpSXXacwzsm2M4qXqqwqE+Zqc354CH8EgmK/zA+tkuPiSSIcwn8B4CoOE1Gpz C+OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782889469; x=1783494269; 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=Frs6Emcy9pNNZIaepK2NrL0xBcYA3u3r9RRnho4i+Lk=; b=RjHxv9qwDgjw8iobXkFvOiG0rEkGA6JUyzeS1le+oj/g/kSfF7Al8izJtcYxyUAcss pBuuOL7aEDfns5cQNUEN9MJcCEed+Gk27poqsPID+k+0DZNk8eIufuZwcGPi8omoJZrL +pEivtYQxKUwtugxkRgMRpJxBeG1OE8l5Jm9MH6pJASu6aYcQFg4dop2B9gJ0ZFsrSsQ Yj34iYtEBF1CemWXmlsV7jkoileu2sdf+GRw1E8LodvGtclc7slGX/Iu3C1pDC3OGtUG pt24a1sz8j0DhC94uJDZzDF6N/5RGTmDNcCSJjjX3b10b/Anunq9wOK2XIh9m8PNObj7 Hxyg== X-Forwarded-Encrypted: i=1; AFNElJ/Ekkwxs0oo3TpBbBkm/Avl8ckbTkyk47Qj1ikTYNuir29aBet6Qnh9GHaXz3pC9YvId0eBQQwuxymA7Jk=@vger.kernel.org X-Gm-Message-State: AOJu0YynBwXxn5Fncii3bZPJkL0gBDbzTDrzdLbEMxzr2LpxcvMFBvGF hm/ywVwjV6glHlGGAxNxn8KH6Q1CE4eNluBuQplyajLEm6Zu09U6OuktxiarM9G0/nNgulAueot Dhz+7 X-Gm-Gg: AfdE7cl49sKVQm1SCsqYBHdDWml5luDpTDLf5lYnX5mqBM/KZT4BMwZGDG7kiG2LxzY De1LDnvBcVvFesjGdmpT4ta+cRWKa/lbRlIIHNXu54Lk/KVemCYf22mbcTxxpxHf7rEcYZAfD+5 EixGFvVPXKI9DbhsfHJRgEV0Sqpjz/PRZpHpvz6pFnUvoEPltAmaJsogJbLO27NYufEs+UehvIx /QDXj2tmm4Oil5A6Yu6OLDhe3D8qJU4mteaHE6dP+/7A3M21kVrzW2UPg1REtl1dWOz72vwqZiX KQvjJAwYg/yPgxq5g48IbNgLnH/3PDXIR4n3ZlaRLQOvBqr6huq3irFGKWS9DhjvwXgFclicEKu wvteHrRMXmZaq1l5Zl4t2X3z3G9FFZEXRaB5hV01zTaMf0MFWwGH0W0aQSO2wBrDqcyUTYltvta X2g4nsr1cAxVKwT0kVYvUX5g6hUVvsYwyjYEpSobxzu9AY7qc= X-Received: by 2002:a05:600c:3e14:b0:492:437a:a653 with SMTP id 5b1f17b1804b1-493c2b9022dmr4676775e9.26.1782889445790; Wed, 01 Jul 2026 00:04:05 -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 5b1f17b1804b1-493be81df2asm94738895e9.12.2026.07.01.00.04.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 00:04:05 -0700 (PDT) Message-ID: <9bc4021f-0648-4cea-9f27-8ee2bd9e7088@suse.com> Date: Wed, 1 Jul 2026 09:04:04 +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 4/4] scsi: sym53c8xx_2: replace __get_free_pages() with kmalloc() 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-4-494fb37ebe7b@kernel.org> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260630-b4-scsi-v1-4-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: > sym53c8xx_2 driver has an internal memory allocator for small > allocations of the driver structures. The backing memory for that > allocator is allocated with __get_free_pages(). > > 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. > > Performance difference between kmalloc() and __get_free_pages() is not > measurable as both allocators take an object/page from a per-CPU list for > fast path allocations. > > For the slow path the performance is anyway determined by the amount of > reclaim involved rather than by what allocator is used. > > Replace use of __get_free_pages() with kmalloc() and free_pages() with > kfree(). > > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com > Signed-off-by: Mike Rapoport (Microsoft) > --- > drivers/scsi/sym53c8xx_2/sym_hipd.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h > index 9231a2899064..aa365e8ba66f 100644 > --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h > +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h > @@ -1110,9 +1110,9 @@ sym_build_sge(struct sym_hcb *np, struct sym_tblmove *data, u64 badd, int len) > */ > > #define sym_get_mem_cluster() \ > - (void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER) > + kmalloc(PAGE_SIZE << SYM_MEM_PAGE_ORDER, GFP_ATOMIC) > #define sym_free_mem_cluster(p) \ > - free_pages((unsigned long)p, SYM_MEM_PAGE_ORDER) > + kfree(p) > > /* > * Link between free memory chunks of a given size. > Reviewed-by: Hannes Reinecke 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