linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ira Weiny <ira.weiny@intel.com>,
	linux-mm@kvack.org, Atul Gupta <atul.gupta@chelsio.com>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 1/3] mm: Introduce page_size()
Date: Fri, 20 Sep 2019 18:09:48 -0700	[thread overview]
Message-ID: <20190921010948.GD15392@bombadil.infradead.org> (raw)
In-Reply-To: <20190920162848.950dd70264e670a485f410dc@linux-foundation.org>

On Fri, Sep 20, 2019 at 04:28:48PM -0700, Andrew Morton wrote:
> On Tue, 23 Jul 2019 09:02:48 -0700 Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Mon, Jul 22, 2019 at 05:43:07PM -0700, Ira Weiny wrote:
> > > > diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
> > > > index 551bca6fef24..925be5942895 100644
> > > > --- a/drivers/crypto/chelsio/chtls/chtls_io.c
> > > > +++ b/drivers/crypto/chelsio/chtls/chtls_io.c
> > > > @@ -1078,7 +1078,7 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> > > >  			bool merge;
> > > >  
> > > >  			if (page)
> > > > -				pg_size <<= compound_order(page);
> > > > +				pg_size = page_size(page);
> > > >  			if (off < pg_size &&
> > > >  			    skb_can_coalesce(skb, i, page, off)) {
> > > >  				merge = 1;
> > > > @@ -1105,8 +1105,7 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> > > >  							   __GFP_NORETRY,
> > > >  							   order);
> > > >  					if (page)
> > > > -						pg_size <<=
> > > > -							compound_order(page);
> > > > +						pg_size <<= order;
> > > 
> > > Looking at the code I see pg_size should be PAGE_SIZE right before this so why
> > > not just use the new call and remove the initial assignment?
> > 
> > This driver is really convoluted.  I wasn't certain I wouldn't break it
> > in some horrid way.  I made larger changes to it originally, then they
> > touched this part of the driver and I had to rework the patch to apply
> > on top of their changes.  So I did something more minimal.
> > 
> > This, on top of what's in Andrew's tree, would be my guess, but I don't
> > have the hardware.
> > 
> > diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
> > index 925be5942895..d4eb0fcd04c7 100644
> > --- a/drivers/crypto/chelsio/chtls/chtls_io.c
> > +++ b/drivers/crypto/chelsio/chtls/chtls_io.c
> > @@ -1073,7 +1073,7 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> >  		} else {
> >  			int i = skb_shinfo(skb)->nr_frags;
> >  			struct page *page = TCP_PAGE(sk);
> > -			int pg_size = PAGE_SIZE;
> > +			unsigned int pg_size = 0;
> >  			int off = TCP_OFF(sk);
> >  			bool merge;
> >  
> > @@ -1092,7 +1092,7 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> >  			if (page && off == pg_size) {
> >  				put_page(page);
> >  				TCP_PAGE(sk) = page = NULL;
> > -				pg_size = PAGE_SIZE;
> > +				pg_size = 0;
> >  			}
> >  
> >  			if (!page) {
> > @@ -1104,15 +1104,13 @@ int chtls_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> >  							   __GFP_NOWARN |
> >  							   __GFP_NORETRY,
> >  							   order);
> > -					if (page)
> > -						pg_size <<= order;
> >  				}
> >  				if (!page) {
> >  					page = alloc_page(gfp);
> > -					pg_size = PAGE_SIZE;
> >  				}
> >  				if (!page)
> >  					goto wait_for_memory;
> > +				pg_size = page_size(page);
> >  				off = 0;
> >  			}
> 
> I didn't do anything with this.  I assume the original patch (which has
> been in -next since July 22) is good and the above is merely a cleanup?

Yes, just a cleanup.  Since Atul didn't offer an opinion, I assume
he doesn't care.


  reply	other threads:[~2019-09-21  1:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-21 10:46 [PATCH v2 0/3] Make working with compound pages easier Matthew Wilcox
2019-07-21 10:46 ` [PATCH v2 1/3] mm: Introduce page_size() Matthew Wilcox
2019-07-23  0:43   ` Ira Weiny
2019-07-23 16:02     ` Matthew Wilcox
2019-07-23 17:58       ` Ira Weiny
2019-07-23 18:14         ` Matthew Wilcox
2019-07-23 20:44           ` Ira Weiny
2019-07-23 21:03             ` Matthew Wilcox
2019-09-20 23:28       ` Andrew Morton
2019-09-21  1:09         ` Matthew Wilcox [this message]
2019-09-22  2:13           ` Weiny, Ira
2019-07-21 10:46 ` [PATCH v2 2/3] mm: Introduce page_shift() Matthew Wilcox
2019-07-23  0:44   ` Ira Weiny
2019-07-24 10:40   ` kbuild test robot
2019-07-25  0:30     ` Andrew Morton
2019-07-25 20:30       ` Ira Weiny
2019-09-23 20:30         ` Matthew Wilcox
2019-07-21 10:46 ` [PATCH v2 3/3] mm: Introduce compound_nr() Matthew Wilcox
2019-07-23  0:46   ` Ira Weiny
2019-07-23 12:55 ` [PATCH v2 0/3] Make working with compound pages easier Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190921010948.GD15392@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=atul.gupta@chelsio.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).