dibs: Re-apply lost patch
Subsystems (4)
PATCH 1/1 dibs: Re-apply lost patch
While merging the dibs layer, Matt [1] noticed that the changes which were done in [2] conflicted and were missing. He subsequently fixed this in the merge commit of his own tree, but the changes never made it upstream.
This commit re-introduces the changes.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] a35c04de2565d ("net/smc: fix warning in smc_rx_splice() when calling get_page()")
--- drivers/dibs/dibs_loopback.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/dibs/dibs_loopback.c +10 -5
@@ -12,6 +12,7 @@#include <linux/bitops.h> #include <linux/device.h> #include <linux/dibs.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/types.h>
@@ -49,6 +50,7 @@ static int dibs_lo_register_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb, {struct dibs_lo_dmb_node *dmb_node, *tmp_node;struct dibs_lo_dev *ldev; +struct folio *folio;unsigned long flags;int sba_idx, rc;
@@ -70,13 +72,16 @@ static int dibs_lo_register_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb, dmb_node->sba_idx = sba_idx; dmb_node->len = dmb->dmb_len; - dmb_node->cpu_addr =kzalloc (dmb_node->len,GFP_KERNEL | - __GFP_NOWARN | __GFP_NORETRY | - __GFP_NOMEMALLOC); -if (!dmb_node->cpu_addr) { + +/* not critical; fail under memory pressure and fallback to TCP */ + folio =folio_alloc (GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | + __GFP_NORETRY | __GFP_ZERO, +get_order (dmb_node->len)); +if (!folio) { rc = -ENOMEM ; goto err_node; } + dmb_node->cpu_addr =folio_address (folio); dmb_node->dma_addr =DIBS_DMA_ADDR_INVALID ;refcount_set (&dmb_node->refcnt,1 );
@@ -122,7 +127,7 @@ static void __dibs_lo_unregister_dmb(struct dibs_lo_dev *ldev,write_unlock_bh (&ldev->dmb_ht_lock);clear_bit (dmb_node->sba_idx, ldev->sba_idx_mask); -kfree (dmb_node->cpu_addr); +folio_put (virt_to_folio (dmb_node->cpu_addr));kfree (dmb_node);if (atomic_dec_and_test (&ldev->dmb_cnt))
Signature · 1 line
2.52.0
Hi Steffen,
Quoted 8 lines · Steffen Jaeckel
While merging the dibs layer, Matt [1] noticed that the changes which were done in [2] conflicted and were missing. He subsequently fixed this in the merge commit of his own tree, but the changes never made it upstream.
This commit re-introduces the changes.
[1] https://lore.kernel.org/netdev/[email protected]/
[2]a35c04de2565d("net/smc: fix warning insmc_rx_splice()when callingget_page()")
Thank you for the follow-up.
On which tree is this patch based on? Because I don't see the missing resolution on net-next and even in Linus tree, see commit 203e3beb73e5 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net") or check the file in Linus tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/dibs/dibs_loopback.c
Am I missing something?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Matt,
Quoted 2 lines · Matthieu Baerts
[...] see commit
203e3beb73e5
("Mergegit://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")[...]
sorry for the noise, I missed that merge commit and didn't look at the current state.
Cheers
Steffen
Signature · 4 lines
Steffen Jaeckel Kernel Network Engineer [email protected] SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: J. Jaser, A. McDonald, W. Knoblich