From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,willy@infradead.org,nphamcs@gmail.com,Liam.Howlett@oracle.com,hughd@google.com,baolin.wang@linux.alibaba.com,shakeel.butt@linux.dev,akpm@linux-foundation.org
Subject: [merged mm-stable] mm-replace-xa_get_order-with-xas_get_order-where-appropriate.patch removed from -mm tree
Date: Mon, 09 Sep 2024 16:42:00 -0700 [thread overview]
Message-ID: <20240909234201.81550C4CEC6@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: replace xa_get_order with xas_get_order where appropriate
has been removed from the -mm tree. Its filename was
mm-replace-xa_get_order-with-xas_get_order-where-appropriate.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Shakeel Butt <shakeel.butt@linux.dev>
Subject: mm: replace xa_get_order with xas_get_order where appropriate
Date: Fri, 6 Sep 2024 16:05:12 -0700
The tracing of invalidation and truncation operations on large files
showed that xa_get_order() is among the top functions where kernel spends
a lot of CPUs. xa_get_order() needs to traverse the tree to reach the
right node for a given index and then extract the order of the entry.
However it seems like at many places it is being called within an already
happening tree traversal where there is no need to do another traversal.
Just use xas_get_order() at those places.
Link: https://lkml.kernel.org/r/20240906230512.124643-1-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/filemap.c | 6 +++---
mm/shmem.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
--- a/mm/filemap.c~mm-replace-xa_get_order-with-xas_get_order-where-appropriate
+++ a/mm/filemap.c
@@ -2112,7 +2112,7 @@ unsigned find_lock_entries(struct addres
VM_BUG_ON_FOLIO(!folio_contains(folio, xas.xa_index),
folio);
} else {
- nr = 1 << xa_get_order(&mapping->i_pages, xas.xa_index);
+ nr = 1 << xas_get_order(&xas);
base = xas.xa_index & ~(nr - 1);
/* Omit order>0 value which begins before the start */
if (base < *start)
@@ -3001,7 +3001,7 @@ unlock:
static inline size_t seek_folio_size(struct xa_state *xas, struct folio *folio)
{
if (xa_is_value(folio))
- return PAGE_SIZE << xa_get_order(xas->xa, xas->xa_index);
+ return PAGE_SIZE << xas_get_order(xas);
return folio_size(folio);
}
@@ -4297,7 +4297,7 @@ static void filemap_cachestat(struct add
if (xas_retry(&xas, folio))
continue;
- order = xa_get_order(xas.xa, xas.xa_index);
+ order = xas_get_order(&xas);
nr_pages = 1 << order;
folio_first_index = round_down(xas.xa_index, 1 << order);
folio_last_index = folio_first_index + nr_pages - 1;
--- a/mm/shmem.c~mm-replace-xa_get_order-with-xas_get_order-where-appropriate
+++ a/mm/shmem.c
@@ -890,7 +890,7 @@ unsigned long shmem_partial_swap_usage(s
if (xas_retry(&xas, page))
continue;
if (xa_is_value(page))
- swapped += 1 << xa_get_order(xas.xa, xas.xa_index);
+ swapped += 1 << xas_get_order(&xas);
if (xas.xa_index == max)
break;
if (need_resched()) {
_
Patches currently in -mm which might be from shakeel.butt@linux.dev are
reply other threads:[~2024-09-09 23:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240909234201.81550C4CEC6@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=hughd@google.com \
--cc=mm-commits@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.