Message ID | 20241018105351.1960345-1-linyunsheng@huawei.com (mailing list archive) |
---|---|
Headers | show |
Series | Replace page_frag with page_frag_cache for sk_page_frag() | expand |
On Fri, Oct 18, 2024 at 4:00 AM Yunsheng Lin <linyunsheng@huawei.com> wrote: > > After [1], there are still two implementations for page frag: > > 1. mm/page_alloc.c: net stack seems to be using it in the > rx part with 'struct page_frag_cache' and the main API > being page_frag_alloc_align(). > 2. net/core/sock.c: net stack seems to be using it in the > tx part with 'struct page_frag' and the main API being > skb_page_frag_refill(). > > This patchset tries to unfiy the page frag implementation > by replacing page_frag with page_frag_cache for sk_page_frag() > first. net_high_order_alloc_disable_key for the implementation > in net/core/sock.c doesn't seems matter that much now as pcp > is also supported for high-order pages: > commit 44042b449872 ("mm/page_alloc: allow high-order pages to > be stored on the per-cpu lists") > > As the related change is mostly related to networking, so > targeting the net-next. And will try to replace the rest > of page_frag in the follow patchset. > > After this patchset: > 1. Unify the page frag implementation by taking the best out of > two the existing implementations: we are able to save some space > for the 'page_frag_cache' API user, and avoid 'get_page()' for > the old 'page_frag' API user. > 2. Future bugfix and performance can be done in one place, hence > improving maintainability of page_frag's implementation. > > Kernel Image changing: > Linux Kernel total | text data bss > ------------------------------------------------------ > after 45250307 | 27274279 17209996 766032 > before 45254134 | 27278118 17209984 766032 > delta -3827 | -3839 +12 +0 > > Performance validation: > 1. Using micro-benchmark ko added in patch 1 to test aligned and > non-aligned API performance impact for the existing users, there > is no notiable performance degradation. Instead we seems to have > some major performance boot for both aligned and non-aligned API > after switching to ptr_ring for testing, respectively about 200% > and 10% improvement in arm64 server as below. > > 2. Use the below netcat test case, we also have some minor > performance boot for replacing 'page_frag' with 'page_frag_cache' > after this patchset. > server: taskset -c 32 nc -l -k 1234 > /dev/null > client: perf stat -r 200 -- taskset -c 0 head -c 20G /dev/zero | taskset -c 1 nc 127.0.0.1 1234 > > In order to avoid performance noise as much as possible, the testing > is done in system without any other load and have enough iterations to > prove the data is stable enough, complete log for testing is below: > > perf stat -r 200 -- insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17 test_alloc_len=12 nr_test=51200000 > perf stat -r 200 -- insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17 test_alloc_len=12 nr_test=51200000 test_align=1 > taskset -c 32 nc -l -k 1234 > /dev/null > perf stat -r 200 -- taskset -c 0 head -c 20G /dev/zero | taskset -c 1 nc 127.0.0.1 1234 > > *After* this patchset: > So I still think this set should be split in half in order to make this easier to review. The ones I have provided a review-by for so far seem fine to me. I really think if you just submitted that batch first we can get that landed and let them stew in the kernel for a bit to make sure we didn't miss anything there. As far as the others there is a bunch there for me to try and chew through. A bunch of that is stuff not related necessarily to my version of the page frag stuff that I did so merging the two is a bit less obvious to me. The one thing I am wondering about is the behavior for why we are pulling apart the logic with this "commit" approach that is deferring the offset update which seems to have to happen unless we need to abort. My review time is going to be limited for the next several weeks. As such I will likely not be able to get to a review until Friday or Saturday each week so sending out updates faster than that will not get you any additional reviews from me. Thanks, - Alex
On 10/19/2024 1:39 AM, Alexander Duyck wrote: >> > > So I still think this set should be split in half in order to make > this easier to review. The ones I have provided a review-by for so far > seem fine to me. I really think if you just submitted that batch first > we can get that landed and let them stew in the kernel for a bit to > make sure we didn't miss anything there. It makes sense to me too that it might be better to get those submitted to get more testing if there is no more comment about it. I am guessing they should be targetting net-next tree to get more testing as all the callers of page_frag API seem to be in the networking, right? Hi, David, Jakub & Paolo It would be good if those patches are just cherry-picked from this patchset as those patches with 'Reviewed-by' tag seem to be applying cleanly. Or any better suggestion here? > > As far as the others there is a bunch there for me to try and chew > through. A bunch of that is stuff not related necessarily to my > version of the page frag stuff that I did so merging the two is a bit > less obvious to me. The one thing I am wondering about is the behavior > for why we are pulling apart the logic with this "commit" approach > that is deferring the offset update which seems to have to happen > unless we need to abort. Let's discuss that in patch 7. > > My review time is going to be limited for the next several weeks. As > such I will likely not be able to get to a review until Friday or > Saturday each week so sending out updates faster than that will not > get you any additional reviews from me. Thanks for the time reviewing and reminding about the above. It makes sense to have more time to have more reviewing as long as we are making productive progress. > > Thanks, > > - Alex >
Hi, I just noted MM maintainer and ML was not CC on the cover-letter (but they were on the relevant patches), adding them now. On 10/19/24 10:27, Yunsheng Lin wrote: > On 10/19/2024 1:39 AM, Alexander Duyck wrote: >> So I still think this set should be split in half in order to make >> this easier to review. The ones I have provided a review-by for so far >> seem fine to me. I really think if you just submitted that batch first >> we can get that landed and let them stew in the kernel for a bit to >> make sure we didn't miss anything there. > > It makes sense to me too that it might be better to get those submitted > to get more testing if there is no more comment about it. > > I am guessing they should be targetting net-next tree to get more > testing as all the callers of page_frag API seem to be in the > networking, right? > > Hi, David, Jakub & Paolo > It would be good if those patches are just cherry-picked from this > patchset as those patches with 'Reviewed-by' tag seem to be applying > cleanly. Or any better suggestion here? We can cherry pick the patches from the posted series, applying the review tags as needed, but we need an explicit ack from the mm maintainer, given the mentioned patches touch mostly such code. I would like to avoid repeating a recent incident of unintentionally stepping on other subsystem toes. @Andrew: are you ok with the above plan? Thank you, Paolo
On 2024/10/24 17:05, Paolo Abeni wrote: > Hi, > > I just noted MM maintainer and ML was not CC on the cover-letter (but > they were on the relevant patches), adding them now. > > On 10/19/24 10:27, Yunsheng Lin wrote: >> On 10/19/2024 1:39 AM, Alexander Duyck wrote: >>> So I still think this set should be split in half in order to make >>> this easier to review. The ones I have provided a review-by for so far >>> seem fine to me. I really think if you just submitted that batch first >>> we can get that landed and let them stew in the kernel for a bit to >>> make sure we didn't miss anything there. >> >> It makes sense to me too that it might be better to get those submitted >> to get more testing if there is no more comment about it. >> >> I am guessing they should be targetting net-next tree to get more >> testing as all the callers of page_frag API seem to be in the >> networking, right? >> >> Hi, David, Jakub & Paolo >> It would be good if those patches are just cherry-picked from this >> patchset as those patches with 'Reviewed-by' tag seem to be applying >> cleanly. Or any better suggestion here? > > We can cherry pick the patches from the posted series, applying the > review tags as needed, but we need an explicit ack from the mm Thanks. I would be good to cherry pick the below one too, as it has also a 'Reviewed-by' tag. I mentioned that it might be easier to miss that one because it sits after one without 'Reviewed-by' and it seems to be also applied cleanly: [net-next,v22,08/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() https://patchwork.kernel.org/project/netdevbpf/patch/20241018105351.1960345-9-linyunsheng@huawei.com/ > maintainer, given the mentioned patches touch mostly such code. Sorry for missing to cc Andrew and MM ML. Maybe I should have mentioned that Andrew provided an 'Acked-by' in patch 2, but it is always safer to double check it. > > I would like to avoid repeating a recent incident of unintentionally > stepping on other subsystem toes. > > @Andrew: are you ok with the above plan? > > Thank you, > > Paolo > >
Hi, Andrew On 10/24/2024 5:05 PM, Paolo Abeni wrote: > Hi, > > I just noted MM maintainer and ML was not CC on the cover-letter (but > they were on the relevant patches), adding them now. > > On 10/19/24 10:27, Yunsheng Lin wrote: >> On 10/19/2024 1:39 AM, Alexander Duyck wrote: >>> So I still think this set should be split in half in order to make >>> this easier to review. The ones I have provided a review-by for so far >>> seem fine to me. I really think if you just submitted that batch first >>> we can get that landed and let them stew in the kernel for a bit to >>> make sure we didn't miss anything there. >> >> It makes sense to me too that it might be better to get those submitted >> to get more testing if there is no more comment about it. >> >> I am guessing they should be targetting net-next tree to get more >> testing as all the callers of page_frag API seem to be in the >> networking, right? >> >> Hi, David, Jakub & Paolo >> It would be good if those patches are just cherry-picked from this >> patchset as those patches with 'Reviewed-by' tag seem to be applying >> cleanly. Or any better suggestion here? > > We can cherry pick the patches from the posted series, applying the > review tags as needed, but we need an explicit ack from the mm > maintainer, given the mentioned patches touch mostly such code. > > I would like to avoid repeating a recent incident of unintentionally > stepping on other subsystem toes. > > @Andrew: are you ok with the above plan? Are the above patches cherry-picked to net-next tree ok with you? More specifically, they are patch 1, 2, 3, 4, 5, 6, 8 with at least one 'Acked-by' or 'Reviewed-by' tag. Or any better suggestion about the plan?