Re: + mm-shmem-fallback-to-page-size-splice-if-large-folio-has-poisoned-pages.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2024/10/31 21:16, David Howells wrote:
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

+		/*
+		 * Fallback to PAGE_SIZE splice if the large folio has hwpoisoned
+		 * pages.
+		 */
+		if (likely(!fallback_page_splice)) {
+			size = len;
+		} else {
+			size_t offset = *ppos & ~PAGE_MASK;
+
+			size = min_t(loff_t, PAGE_SIZE - offset, len);
+		}

It might look better to write this as:

		size = len;
		if (unlikely(fallback_page_splice)) {
			size_t offset = *ppos & ~PAGE_MASK;

			size = umin(size, PAGE_SIZE - offset);
		}

Yes, looks better. Thanks.

Andrew, could you help squash the following changes into this patch? Thanks.

diff --git a/mm/shmem.c b/mm/shmem.c
index 44282a296c33..d910063dac27 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3335,12 +3335,11 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, * Fallback to PAGE_SIZE splice if the large folio has hwpoisoned
                 * pages.
                 */
-               if (likely(!fallback_page_splice)) {
-                       size = len;
-               } else {
+               size = len;
+               if (unlikely(fallback_page_splice)) {
                        size_t offset = *ppos & ~PAGE_MASK;

-                       size = min_t(loff_t, PAGE_SIZE - offset, len);
+                       size = umin(size, PAGE_SIZE - offset);
                }
                part = min_t(loff_t, isize - *ppos, size);




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux