netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion
@ 2019-05-01  4:17 Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 1/5] net: Increase the size of skb_frag_t Matthew Wilcox
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

It turns out there's a lot of accessors for the skb_frag, which would
make this conversion really easy if some drivers didn't bypass them.
This is what I've done so far; my laptop's not really beefy enough to
cope with changing skbuff.h too often ;-)

This would be a great time to tell me I'm going about this all wrong.
I already found one problem in this patch set; some of the drivers should
have been converted to skb_frag_dma_map() instead of fixing the arguments
to dma_map_page().  But anyway, I need sleep.

Matthew Wilcox (Oracle) (5):
  net: Increase the size of skb_frag_t
  net: Reorder the contents of skb_frag_t
  net: Include bvec.h in skbuff.h
  net: Use skb accessors for skb->page
  net: Rename skb_frag page to bv_page

 drivers/hsi/clients/ssi_protocol.c            |  3 ++-
 .../net/ethernet/cavium/liquidio/lio_main.c   |  2 +-
 .../ethernet/cavium/liquidio/lio_vf_main.c    |  2 +-
 drivers/net/ethernet/freescale/fec_main.c     |  2 +-
 drivers/net/ethernet/marvell/mvneta.c         |  2 +-
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  2 +-
 drivers/net/ethernet/qualcomm/emac/emac-mac.c |  3 ++-
 drivers/net/usb/usbnet.c                      |  2 +-
 drivers/net/xen-netback/netback.c             |  4 ++--
 drivers/staging/octeon/ethernet-tx.c          |  3 +--
 drivers/target/iscsi/cxgbit/cxgbit_target.c   |  6 +++---
 include/linux/skbuff.h                        | 20 +++++++------------
 net/core/skbuff.c                             |  8 ++++----
 net/core/tso.c                                |  4 ++--
 net/kcm/kcmsock.c                             |  2 +-
 net/tls/tls_device.c                          |  4 ++--
 16 files changed, 32 insertions(+), 37 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] net: Increase the size of skb_frag_t
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
@ 2019-05-01  4:17 ` Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 2/5] net: Reorder the contents " Matthew Wilcox
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

To increase commonality between block and net, we are going to replace
the skb_frag_t with the bio_vec.  This patch increases the size of
skb_frag_t on 32-bit machines from 8 bytes to 12 bytes.  The size is
unchanged on 64-bit machines.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/skbuff.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9027a8c4219f..23f05c64aa31 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -318,13 +318,8 @@ struct skb_frag_struct {
 	struct {
 		struct page *p;
 	} page;
-#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
 	__u32 page_offset;
 	__u32 size;
-#else
-	__u16 page_offset;
-	__u16 size;
-#endif
 };
 
 /**
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] net: Reorder the contents of skb_frag_t
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 1/5] net: Increase the size of skb_frag_t Matthew Wilcox
@ 2019-05-01  4:17 ` Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 3/5] net: Include bvec.h in skbuff.h Matthew Wilcox
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Match the layout of bio_vec.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/skbuff.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 23f05c64aa31..9c6193a57241 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -318,8 +318,8 @@ struct skb_frag_struct {
 	struct {
 		struct page *p;
 	} page;
-	__u32 page_offset;
 	__u32 size;
+	__u32 page_offset;
 };
 
 /**
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] net: Include bvec.h in skbuff.h
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 1/5] net: Increase the size of skb_frag_t Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 2/5] net: Reorder the contents " Matthew Wilcox
@ 2019-05-01  4:17 ` Matthew Wilcox
  2019-05-01  4:17 ` [PATCH 4/5] net: Use skb accessors for skb->page Matthew Wilcox
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Add the dependency now, even though we're not using the bio_vec yet.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/skbuff.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9c6193a57241..bc416e5886f4 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -18,6 +18,7 @@
 #include <linux/compiler.h>
 #include <linux/time.h>
 #include <linux/bug.h>
+#include <linux/bvec.h>
 #include <linux/cache.h>
 #include <linux/rbtree.h>
 #include <linux/socket.h>
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] net: Use skb accessors for skb->page
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
                   ` (2 preceding siblings ...)
  2019-05-01  4:17 ` [PATCH 3/5] net: Include bvec.h in skbuff.h Matthew Wilcox
@ 2019-05-01  4:17 ` Matthew Wilcox
  2019-05-02 10:21   ` kbuild test robot
  2019-05-01  4:17 ` [PATCH 5/5] net: Rename skb_frag page to bv_page Matthew Wilcox
  2019-05-01  8:14 ` [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Eric Dumazet
  5 siblings, 1 reply; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

In preparation for renaming skb->page, use the fine accessors which
already exist.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 drivers/hsi/clients/ssi_protocol.c                 | 3 ++-
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 2 +-
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
 drivers/net/ethernet/freescale/fec_main.c          | 2 +-
 drivers/net/ethernet/marvell/mvneta.c              | 2 +-
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c    | 2 +-
 drivers/net/ethernet/qualcomm/emac/emac-mac.c      | 3 ++-
 drivers/net/usb/usbnet.c                           | 2 +-
 drivers/net/xen-netback/netback.c                  | 4 ++--
 drivers/staging/octeon/ethernet-tx.c               | 3 +--
 drivers/target/iscsi/cxgbit/cxgbit_target.c        | 6 +++---
 net/core/skbuff.c                                  | 6 +++---
 net/core/tso.c                                     | 4 ++--
 net/kcm/kcmsock.c                                  | 2 +-
 net/tls/tls_device.c                               | 4 ++--
 15 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 561abf7bdf1f..9f506c00ad85 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -194,7 +194,8 @@ static void ssip_skb_to_msg(struct sk_buff *skb, struct hsi_msg *msg)
 		sg = sg_next(sg);
 		BUG_ON(!sg);
 		frag = &skb_shinfo(skb)->frags[i];
-		sg_set_page(sg, frag->page.p, frag->size, frag->page_offset);
+		sg_set_page(sg, skb_page_frag(frag), frag->size,
+				frag->page_offset);
 	}
 }
 
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index fb6f813cff65..96ea3f6452a8 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -2463,7 +2463,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
 
 			g->sg[(i >> 2)].ptr[(i & 3)] =
 				dma_map_page(&oct->pci_dev->dev,
-					     frag->page.p,
+					     skb_frag_page(frag),
 					     frag->page_offset,
 					     frag->size,
 					     DMA_TO_DEVICE);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 54b245797d2e..b25db603443d 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -1536,7 +1536,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
 
 			g->sg[(i >> 2)].ptr[(i & 3)] =
 				dma_map_page(&oct->pci_dev->dev,
-					     frag->page.p,
+					     skb_frag_page(frag),
 					     frag->page_offset,
 					     frag->size,
 					     DMA_TO_DEVICE);
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a96ad20ee484..d0fcb4231451 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -387,7 +387,7 @@ fec_enet_txq_submit_frag_skb(struct fec_enet_priv_tx_q *txq,
 			ebdp->cbd_esc = cpu_to_fec32(estatus);
 		}
 
-		bufaddr = page_address(this_frag->page.p) + this_frag->page_offset;
+		bufaddr = skb_frag_address(this_frag);
 
 		index = fec_enet_get_bd_index(bdp, &txq->bd);
 		if (((unsigned long) bufaddr) & fep->tx_align ||
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index c0a3718b2e2a..54dd9cb88dee 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2349,7 +2349,7 @@ static int mvneta_tx_frag_process(struct mvneta_port *pp, struct sk_buff *skb,
 
 	for (i = 0; i < nr_frags; i++) {
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-		void *addr = page_address(frag->page.p) + frag->page_offset;
+		void *addr = skb_frag_address(frag);
 
 		tx_desc = mvneta_txq_next_desc_get(txq);
 		tx_desc->data_size = frag->size;
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 25fbed2b8d94..3f30f8f49906 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -2822,7 +2822,7 @@ static int mvpp2_tx_frag_process(struct mvpp2_port *port, struct sk_buff *skb,
 
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-		void *addr = page_address(frag->page.p) + frag->page_offset;
+		void *addr = skb_frag_address(frag);
 
 		tx_desc = mvpp2_txq_next_desc_get(aggr_txq);
 		mvpp2_txdesc_txq_set(port, tx_desc, txq->id);
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 20d2400ad300..dc4e58100264 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -1400,7 +1400,8 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt,
 		tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx);
 		tpbuf->length = frag->size;
 		tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
-					       frag->page.p, frag->page_offset,
+					       skb_frag_page(frag),
+					       frag->page_offset,
 					       tpbuf->length, DMA_TO_DEVICE);
 		ret = dma_mapping_error(adpt->netdev->dev.parent,
 					tpbuf->dma_addr);
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 504282af27e5..5c893726aa09 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1338,7 +1338,7 @@ static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
 		struct skb_frag_struct *f = &skb_shinfo(skb)->frags[i];
 
 		total_len += skb_frag_size(f);
-		sg_set_page(&urb->sg[i + s], f->page.p, f->size,
+		sg_set_page(&urb->sg[i + s], skb_frag_page(f), f->size,
 				f->page_offset);
 	}
 	urb->transfer_buffer_length = total_len;
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 1d9940d4e8c7..a96c5c2a2c5a 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1055,7 +1055,7 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
 			int j;
 			skb->truesize += skb->data_len;
 			for (j = 0; j < i; j++)
-				put_page(frags[j].page.p);
+				put_page(skb_frag_page(&frags[j]));
 			return -ENOMEM;
 		}
 
@@ -1067,7 +1067,7 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
 			BUG();
 
 		offset += len;
-		frags[i].page.p = page;
+		__skb_frag_set_page(&frags[i], page);
 		frags[i].page_offset = 0;
 		skb_frag_size_set(&frags[i], len);
 	}
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index 317c9720467c..29a31f37f66b 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -281,8 +281,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
 			struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
 
 			hw_buffer.s.addr = XKPHYS_TO_PHYS(
-				(u64)(page_address(fs->page.p) +
-				fs->page_offset));
+				(u64)skb_frag_address(fs));
 			hw_buffer.s.size = fs->size;
 			CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
 		}
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 29b350a0b58f..9cac100b3169 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -902,9 +902,9 @@ cxgbit_handle_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr,
 		skb_frag_t *dfrag = &ssi->frags[pdu_cb->dfrag_idx];
 
 		sg_init_table(&ccmd->sg, 1);
-		sg_set_page(&ccmd->sg, dfrag->page.p, skb_frag_size(dfrag),
-			    dfrag->page_offset);
-		get_page(dfrag->page.p);
+		sg_set_page(&ccmd->sg, skb_frag_page(dfrag),
+				skb_frag_size(dfrag), dfrag->page_offset);
+		get_page(skb_frag_page(dfrag));
 
 		cmd->se_cmd.t_data_sg = &ccmd->sg;
 		cmd->se_cmd.t_data_nents = 1;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 40796b8bf820..12b60fdcff46 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2337,7 +2337,7 @@ int skb_send_sock_locked(struct sock *sk, struct sk_buff *skb, int offset,
 		slen = min_t(size_t, len, frag->size - offset);
 
 		while (slen) {
-			ret = kernel_sendpage_locked(sk, frag->page.p,
+			ret = kernel_sendpage_locked(sk, skb_frag_page(frag),
 						     frag->page_offset + offset,
 						     slen, MSG_DONTWAIT);
 			if (ret <= 0)
@@ -3459,7 +3459,7 @@ static inline skb_frag_t skb_head_frag_to_page_desc(struct sk_buff *frag_skb)
 	struct page *page;
 
 	page = virt_to_head_page(frag_skb->head);
-	head_frag.page.p = page;
+	__skb_frag_set_page(&head_frag, page);
 	head_frag.page_offset = frag_skb->data -
 		(unsigned char *)page_address(page);
 	head_frag.size = skb_headlen(frag_skb);
@@ -3855,7 +3855,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
 
 		pinfo->nr_frags = nr_frags + 1 + skbinfo->nr_frags;
 
-		frag->page.p	  = page;
+		__skb_frag_set_page(frag, page);
 		frag->page_offset = first_offset;
 		skb_frag_size_set(frag, first_size);
 
diff --git a/net/core/tso.c b/net/core/tso.c
index 43f4eba61933..b4fc8481d5bd 100644
--- a/net/core/tso.c
+++ b/net/core/tso.c
@@ -56,7 +56,7 @@ void tso_build_data(struct sk_buff *skb, struct tso_t *tso, int size)
 
 		/* Move to next segment */
 		tso->size = frag->size;
-		tso->data = page_address(frag->page.p) + frag->page_offset;
+		tso->data = skb_frag_address(frag);
 		tso->next_frag_idx++;
 	}
 }
@@ -80,7 +80,7 @@ void tso_start(struct sk_buff *skb, struct tso_t *tso)
 
 		/* Move to next segment */
 		tso->size = frag->size;
-		tso->data = page_address(frag->page.p) + frag->page_offset;
+		tso->data = skb_frag_address(frag);
 		tso->next_frag_idx++;
 	}
 }
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 44fdc641710d..194c30b79007 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -644,7 +644,7 @@ static int kcm_write_msgs(struct kcm_sock *kcm)
 			}
 
 			ret = kernel_sendpage(psock->sk->sk_socket,
-					      frag->page.p,
+					      skb_frag_page(frag),
 					      frag->page_offset + frag_offset,
 					      frag->size - frag_offset,
 					      MSG_DONTWAIT);
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index cc0256939eb6..68c17af6f150 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -233,12 +233,12 @@ static void tls_append_frag(struct tls_record_info *record,
 	skb_frag_t *frag;
 
 	frag = &record->frags[record->num_frags - 1];
-	if (frag->page.p == pfrag->page &&
+	if (skb_frag_page(frag) == pfrag->page &&
 	    frag->page_offset + frag->size == pfrag->offset) {
 		frag->size += size;
 	} else {
 		++frag;
-		frag->page.p = pfrag->page;
+		__skb_frag_set_page(frag, pfrag->page);
 		frag->page_offset = pfrag->offset;
 		frag->size = size;
 		++record->num_frags;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] net: Rename skb_frag page to bv_page
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
                   ` (3 preceding siblings ...)
  2019-05-01  4:17 ` [PATCH 4/5] net: Use skb accessors for skb->page Matthew Wilcox
@ 2019-05-01  4:17 ` Matthew Wilcox
  2019-05-01  8:14 ` [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Eric Dumazet
  5 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  4:17 UTC (permalink / raw)
  To: davem; +Cc: Matthew Wilcox (Oracle), hch, netdev

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

One step closer to turning the skb_frag_t into a bio_vec.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/skbuff.h | 12 +++++-------
 net/core/skbuff.c      |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bc416e5886f4..1fc0592d6a06 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -316,9 +316,7 @@ extern int sysctl_max_skb_frags;
 typedef struct skb_frag_struct skb_frag_t;
 
 struct skb_frag_struct {
-	struct {
-		struct page *p;
-	} page;
+	struct page *bv_page;
 	__u32 size;
 	__u32 page_offset;
 };
@@ -379,7 +377,7 @@ static inline bool skb_frag_must_loop(struct page *p)
  *	skb_frag_foreach_page - loop over pages in a fragment
  *
  *	@f:		skb frag to operate on
- *	@f_off:		offset from start of f->page.p
+ *	@f_off:		offset from start of f->bv_page
  *	@f_len:		length from f_off to loop over
  *	@p:		(temp var) current page
  *	@p_off:		(temp var) offset from start of current page,
@@ -2062,7 +2060,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
 	 * that not all callers have unique ownership of the page but rely
 	 * on page_is_pfmemalloc doing the right thing(tm).
 	 */
-	frag->page.p		  = page;
+	frag->bv_page		  = page;
 	frag->page_offset	  = off;
 	skb_frag_size_set(frag, size);
 
@@ -2850,7 +2848,7 @@ static inline void skb_propagate_pfmemalloc(struct page *page,
  */
 static inline struct page *skb_frag_page(const skb_frag_t *frag)
 {
-	return frag->page.p;
+	return frag->bv_page;
 }
 
 /**
@@ -2936,7 +2934,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag)
  */
 static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
 {
-	frag->page.p = page;
+	frag->bv_page = page;
 }
 
 /**
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 12b60fdcff46..ee948851fd48 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3194,7 +3194,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
 
 		} else {
 			__skb_frag_ref(fragfrom);
-			fragto->page = fragfrom->page;
+			fragto->bv_page = fragfrom->bv_page;
 			fragto->page_offset = fragfrom->page_offset;
 			skb_frag_size_set(fragto, todo);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion
  2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
                   ` (4 preceding siblings ...)
  2019-05-01  4:17 ` [PATCH 5/5] net: Rename skb_frag page to bv_page Matthew Wilcox
@ 2019-05-01  8:14 ` Eric Dumazet
  2019-05-01  9:44   ` Matthew Wilcox
  5 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2019-05-01  8:14 UTC (permalink / raw)
  To: Matthew Wilcox, davem; +Cc: hch, netdev



On 4/30/19 9:17 PM, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> It turns out there's a lot of accessors for the skb_frag, which would
> make this conversion really easy if some drivers didn't bypass them.
> This is what I've done so far; my laptop's not really beefy enough to
> cope with changing skbuff.h too often ;-)
> 
> This would be a great time to tell me I'm going about this all wrong.
> I already found one problem in this patch set; some of the drivers should
> have been converted to skb_frag_dma_map() instead of fixing the arguments
> to dma_map_page().  But anyway, I need sleep.
> 

I guess the missing part here is the "why" all this is done ?

32 bit hosts will have bigger skb_shared_info and this impacts sk_rcvbuf and sk_sndbuf limits.

17 * 4 are 68 extra bytes per skb.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion
  2019-05-01  8:14 ` [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Eric Dumazet
@ 2019-05-01  9:44   ` Matthew Wilcox
  0 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2019-05-01  9:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, hch, netdev

On Wed, May 01, 2019 at 04:14:41AM -0400, Eric Dumazet wrote:
> On 4/30/19 9:17 PM, Matthew Wilcox wrote:
> > It turns out there's a lot of accessors for the skb_frag, which would
> > make this conversion really easy if some drivers didn't bypass them.
> > This is what I've done so far; my laptop's not really beefy enough to
> > cope with changing skbuff.h too often ;-)
> 
> I guess the missing part here is the "why" all this is done ?
> 
> 32 bit hosts will have bigger skb_shared_info and this impacts sk_rcvbuf and sk_sndbuf limits.
> 
> 17 * 4 are 68 extra bytes per skb.

Right.  The plan is to replace get_user_pages() with get_user_bvec().  If
userspace has physically consecutive pages (and often it will, even when
not using THP), we can reduce the number of elements in the array at the
start.  So each skb_frag_t is larger, but you'll have fewer of them for a
large I/O.  Obviously this particularly benefits THP.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/5] net: Use skb accessors for skb->page
  2019-05-01  4:17 ` [PATCH 4/5] net: Use skb accessors for skb->page Matthew Wilcox
@ 2019-05-02 10:21   ` kbuild test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2019-05-02 10:21 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: kbuild-all, davem, Matthew Wilcox (Oracle), hch, netdev

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]

Hi Matthew,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on v5.1-rc7]
[cannot apply to next-20190501]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Matthew-Wilcox/net-Increase-the-size-of-skb_frag_t/20190502-125302
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/hsi/clients/ssi_protocol.c: In function 'ssip_skb_to_msg':
>> drivers/hsi/clients/ssi_protocol.c:197:19: error: implicit declaration of function 'skb_page_frag'; did you mean 'skb_free_frag'? [-Werror=implicit-function-declaration]
      sg_set_page(sg, skb_page_frag(frag), frag->size,
                      ^~~~~~~~~~~~~
                      skb_free_frag
>> drivers/hsi/clients/ssi_protocol.c:197:19: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
   In file included from include/linux/dma-mapping.h:11:0,
                    from include/linux/skbuff.h:35,
                    from include/linux/if_ether.h:23,
                    from drivers/hsi/clients/ssi_protocol.c:31:
   include/linux/scatterlist.h:116:20: note: expected 'struct page *' but argument is of type 'int'
    static inline void sg_set_page(struct scatterlist *sg, struct page *page,
                       ^~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +197 drivers/hsi/clients/ssi_protocol.c

   182	
   183	static void ssip_skb_to_msg(struct sk_buff *skb, struct hsi_msg *msg)
   184	{
   185		skb_frag_t *frag;
   186		struct scatterlist *sg;
   187		int i;
   188	
   189		BUG_ON(msg->sgt.nents != (unsigned int)(skb_shinfo(skb)->nr_frags + 1));
   190	
   191		sg = msg->sgt.sgl;
   192		sg_set_buf(sg, skb->data, skb_headlen(skb));
   193		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
   194			sg = sg_next(sg);
   195			BUG_ON(!sg);
   196			frag = &skb_shinfo(skb)->frags[i];
 > 197			sg_set_page(sg, skb_page_frag(frag), frag->size,
   198					frag->page_offset);
   199		}
   200	}
   201	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 68290 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-05-02 10:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01  4:17 [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Matthew Wilcox
2019-05-01  4:17 ` [PATCH 1/5] net: Increase the size of skb_frag_t Matthew Wilcox
2019-05-01  4:17 ` [PATCH 2/5] net: Reorder the contents " Matthew Wilcox
2019-05-01  4:17 ` [PATCH 3/5] net: Include bvec.h in skbuff.h Matthew Wilcox
2019-05-01  4:17 ` [PATCH 4/5] net: Use skb accessors for skb->page Matthew Wilcox
2019-05-02 10:21   ` kbuild test robot
2019-05-01  4:17 ` [PATCH 5/5] net: Rename skb_frag page to bv_page Matthew Wilcox
2019-05-01  8:14 ` [PATCH 0/5] Beginnings of skb_frag -> bio_vec conversion Eric Dumazet
2019-05-01  9:44   ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).