struct sk_buff  *sk_send_head;
                struct rb_root  tcp_rtx_queue;
        };
+       struct sk_buff          *sk_tx_skb_cache;
        struct sk_buff_head     sk_write_queue;
        __s32                   sk_peek_off;
        int                     sk_write_pending;
 
 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
 {
+       if (!sk->sk_tx_skb_cache) {
+               sk->sk_tx_skb_cache = skb;
+               return;
+       }
        sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
        sk->sk_wmem_queued -= skb->truesize;
        sk_mem_uncharge(sk, skb->truesize);
 
 {
        struct sk_buff *skb;
 
+       skb = sk->sk_tx_skb_cache;
+       if (skb && !size) {
+               const struct sk_buff_fclones *fclones;
+
+               fclones = container_of(skb, struct sk_buff_fclones, skb1);
+               if (refcount_read(&fclones->fclone_ref) == 1) {
+                       sk->sk_wmem_queued -= skb->truesize;
+                       sk_mem_uncharge(sk, skb->truesize);
+                       skb->truesize -= skb->data_len;
+                       sk->sk_tx_skb_cache = NULL;
+                       pskb_trim(skb, 0);
+                       INIT_LIST_HEAD(&skb->tcp_tsorted_anchor);
+                       return skb;
+               }
+       }
        /* The TCP header must be at least 32-bit aligned.  */
        size = ALIGN(size, 4);
 
 }
 EXPORT_SYMBOL(tcp_sendpage);
 
-/* Do not bother using a page frag for very small frames.
- * But use this heuristic only for the first skb in write queue.
- *
- * Having no payload in skb->head allows better SACK shifting
- * in tcp_shift_skb_data(), reducing sack/rack overhead, because
- * write queue has less skbs.
- * Each skb can hold up to MAX_SKB_FRAGS * 32Kbytes, or ~0.5 MB.
- * This also speeds up tso_fragment(), since it wont fallback
- * to tcp_fragment().
- */
-static int linear_payload_sz(bool first_skb)
-{
-       if (first_skb)
-               return SKB_WITH_OVERHEAD(2048 - MAX_TCP_HEADER);
-       return 0;
-}
-
-static int select_size(bool first_skb, bool zc)
-{
-       if (zc)
-               return 0;
-       return linear_payload_sz(first_skb);
-}
-
 void tcp_free_fastopen_req(struct tcp_sock *tp)
 {
        if (tp->fastopen_req) {
 
                if (copy <= 0 || !tcp_skb_can_collapse_to(skb)) {
                        bool first_skb;
-                       int linear;
 
 new_segment:
                        if (!sk_stream_memory_free(sk))
                                goto restart;
                        }
                        first_skb = tcp_rtx_and_write_queues_empty(sk);
-                       linear = select_size(first_skb, zc);
-                       skb = sk_stream_alloc_skb(sk, linear, sk->sk_allocation,
+                       skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation,
                                                  first_skb);
                        if (!skb)
                                goto wait_for_memory;
                sk_wmem_free_skb(sk, skb);
        }
        tcp_rtx_queue_purge(sk);
+       skb = sk->sk_tx_skb_cache;
+       if (skb) {
+               sk->sk_wmem_queued -= skb->truesize;
+               sk_mem_uncharge(sk, skb->truesize);
+               __kfree_skb(skb);
+               sk->sk_tx_skb_cache = NULL;
+       }
        INIT_LIST_HEAD(&tcp_sk(sk)->tsorted_sent_queue);
        sk_mem_reclaim(sk);
        tcp_clear_all_retrans_hints(tcp_sk(sk));