From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 D56CC3B14C1 for ; Wed, 1 Jul 2026 06:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889097; cv=none; b=njBu6vzc41OPN2YEmGH1qZa/ujp9JA+CI3wf1MvQMUrZ/o6Hk+i2prOHO3wOkQDPkVsHSNcpk4Q2q37ZvOKsGOTO+vma3dNjhl0aONdnZjVFitK90J36QwWs7zPziJZl8rRskmqCRgumU7kNfQBc5NN2v3c8CluEA4Py5n7TC4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889097; c=relaxed/simple; bh=r5m6bx+1S+UH9/Jug1ZvzJIVBVwid5Doa+5SlCgkwB4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HOnEUs/Y/RY5NFKLUhWE1Elplay+z6/kb6AqjvRBJDTkMIhtr+VClPbDKgytmUlgxpbH8ScsKr6dq87w0dn2RxyzaP+33eKTxMYD9z+EGAQ7+J2HzlzJRBCiSKxBx4513g/UaYltSJGi+EwqLswH77WXsEhsS5QJ2QO+ucNSask= 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=Ar2o9mBx; arc=none smtp.client-ip=209.85.221.43 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="Ar2o9mBx" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4745492ed3aso125807f8f.1 for ; Tue, 30 Jun 2026 23:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782889094; x=1783493894; 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=uM40CkIKzZOswsbi2LSbdjru0/A7oQAC4WYJATBuHvw=; b=Ar2o9mBxYp5gMqTnRq7etf2LP0scht+0GyyXIDK7mkABInc3j8qfZcXl81sH0hJNNB NNdDXEc280yQgDVTgKmHoC5tazl09unF/EF1arqknKOoW29eQY3F3J+IV0FoS1mhr0nV zQU7N99HBJvpp/0xioOVhSfmgFU02a1aZ0IMRt8WBMrfuiNIc+hh42Gc6Jyan0hKvqmZ Q/v0McgCgVDLh/YO+dRgL4mmF8+1wTIDt1Btvtut73YOvnAkxbn9b4M52NqiAjFiWDRp PpCt5ipsaIw7bya0p6/HfmJ0t9pF9tQFHrrDT2qIX+kENs9D26IBEkk9IO1ex1CfJzv6 nh8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782889094; x=1783493894; 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=uM40CkIKzZOswsbi2LSbdjru0/A7oQAC4WYJATBuHvw=; b=RrtiL36pyKWu5WkBtp06Xg642kcDTxktB1rD+BDoMkQknvt4eYQUZtx5pKnGEbmRcZ NgCEAtmXuStPicIc/70nT9dmqKMVtPKFFglgL7pSg1Brw71iOyIuUmnRucaxTEoFT2V2 1kxcQ/6RhzFyRxq8ghF+s9WFU9+5r875i3TB4bQb5HSLDLYRwAdXEMcqo8CbAJJ9nktg BeS41fo2B8+1fOQidwirPO21vXsP2imQwWvL6hBb8FSZP/VRXTbS349q0hsV5TOFyABB hwwtxUl6i8uyaYr0zdhL5Ox7vN1cWwC8OuaB6kN9RDl2g4oXWd7tXmGv+QjuKMXjmVTd ApQg== X-Forwarded-Encrypted: i=1; AHgh+Rog1UgnYFRqUxFy0w5b/G/G9oy2PaR0vexNG07lKHeTwf6Ko1SWvQAKb27ARUX6h/UMtIvwD792duhcf+M=@vger.kernel.org X-Gm-Message-State: AOJu0YwMpUrcr70t7PaaBxtZWAyTmWUYGbck8BQHo0Gjar2AMAFvDb83 jzJvk7dBe0dcO/rIPiImsJiHdsF6ayv48oluSEumquRsgsXMK4vpINbyzLU7pJPTBOg= X-Gm-Gg: AfdE7cmHdJbBiqMdearzOYZwRWnVjXVVnOEbONkxRP/zMddujeyhVq0o0s5zr1XvIiS ouwdnWS5MYJzUUo4G2MfYNvpI8/gtUL6v5W8QWBEAQ/8hBoDPGjxStXmT6Qaorq81rhUg/E3CQH TUzHf+hO9gVOHR7wPlgTb5nzBQ19ZqTDq5+3IAMumnUn1qLbKUC6JxWMkOEb4DememmxOLZdrO3 mwBlF0xnaHoNST4Vax2XgQ1lNAjx1FEBLSPUJ9tPFXE90TP7h1E7+KBtGF4aOa1l8RVLeQONH7I 5ZOwxrxT5Ub8PF9CKT6HbjGFVr7oZSgAqNSQUEpWDe2pxYJxBUL0GMpEk7N+WbfnAP7FiNqKaC4 F57FHAr8JEGftWSsm3b9vSuROA6gcPTfJUh3cRca6lx+IA3qdoXK1ER0XgK5To/UynYhUZpS4Pq ybVLrGaPVQfOPH2MbCS7o+pEVvhq3HApGcLVeLErfL2fm0Twre+UHMgjc9nA== X-Received: by 2002:a05:6000:230f:b0:46e:98a7:232b with SMTP id ffacd0b85a97d-477573bbc16mr566600f8f.10.1782889094328; Tue, 30 Jun 2026 23:58:14 -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-4756636cf1asm15708450f8f.18.2026.06.30.23.58.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2026 23:58:13 -0700 (PDT) Message-ID: <1f9329e4-dbe2-4d46-8387-b3c7fc8faab0@suse.com> Date: Wed, 1 Jul 2026 08:58:13 +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 1/4] scsi: target: file: use kmalloc() to allocate temporary protection buffer 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-1-494fb37ebe7b@kernel.org> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260630-b4-scsi-v1-1-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: > fd_do_prot_unmap() uses __get_free_page() to allocate a temporary buffer > that is used to invalidate protection info for the unmapped region by > filling with 0xff pattern. > > This buffer 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/target/target_core_file.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c > index 62ced9f5102f..ab9824a4852f 100644 > --- a/drivers/target/target_core_file.c > +++ b/drivers/target/target_core_file.c > @@ -516,7 +516,7 @@ fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) > void *buf; > int rc; > > - buf = (void *)__get_free_page(GFP_KERNEL); > + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); > if (!buf) { > pr_err("Unable to allocate FILEIO prot buf\n"); > return -ENOMEM; > @@ -524,7 +524,7 @@ fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) > > rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE); > > - free_page((unsigned long)buf); > + kfree(buf); > > return rc; > } > 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