From: kernel test robot <lkp@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: oe-kbuild-all@lists.linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Baoquan He <baoquan.he@linux.dev>, Nhat Pham <nphamcs@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Kairui Song <kasong@tencent.com>
Subject: [linux-next:master 9148/9778] drivers/gpu/drm/ttm/ttm_backup.c:163 ttm_backup_backup_folio() warn: inconsistent indenting
Date: Wed, 29 Jul 2026 16:50:27 +0800 [thread overview]
Message-ID: <202607291606.s2Hw3kEj-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 3652b49adac266a3d27cb41cdfdb7d8790fc3633
commit: 04b6dc72ddbc3192f17353492f0a9e1669c01725 [9148/9778] shmem: provide a shmem_write_folio wrapper
config: alpha-randconfig-r073-20260729 (https://download.01.org/0day-ci/archive/20260729/202607291606.s2Hw3kEj-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 9.5.0
smatch: v0.5.0-9187-g5189e3fb
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607291606.s2Hw3kEj-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/ttm/ttm_backup.c:163 ttm_backup_backup_folio() warn: inconsistent indenting
vim +163 drivers/gpu/drm/ttm/ttm_backup.c
70
71 /**
72 * ttm_backup_backup_folio() - Backup a folio
73 * @backup: The struct backup pointer to use.
74 * @folio: The folio to back up.
75 * @order: The allocation order of @folio. Since TTM allocates higher-order
76 * pages without __GFP_COMP, folio_nr_pages(@folio) would always
77 * return 1; the caller must pass the true order explicitly.
78 * @writeback: Whether to perform immediate writeback of the folio's pages.
79 * This may have performance implications.
80 * @idx: A unique integer for the first page of the folio and each struct backup.
81 * This allows the backup implementation to avoid managing
82 * its address space separately.
83 * @folio_gfp: The gfp value used when the folio was allocated.
84 * Currently unused.
85 * @alloc_gfp: The gfp to be used when allocating memory.
86 * @nr_pages_backed: Output. On a successful return, set to the number of
87 * pages actually backed up, which may be less than (1 << @order)
88 * if an -ENOMEM was encountered mid-folio.
89 *
90 * Context: If called from reclaim context, the caller needs to
91 * assert that the shrinker gfp has __GFP_FS set, to avoid
92 * deadlocking on lock_page(). If @writeback is set to true and
93 * called from reclaim context, the caller also needs to assert
94 * that the shrinker gfp has __GFP_IO set, since without it,
95 * we're not allowed to start backup IO.
96 *
97 * Return: A handle for the first backed-up page on success (handles for
98 * subsequent pages follow sequentially). -ENOMEM if no pages could be backed
99 * up. Any other negative error code if a non-ENOMEM failure occurred; in that
100 * case any pages backed up so far are truncated before returning.
101 */
102 s64
103 ttm_backup_backup_folio(struct file *backup, struct folio *folio,
104 unsigned int order, bool writeback, pgoff_t idx,
105 gfp_t folio_gfp, gfp_t alloc_gfp,
106 pgoff_t *nr_pages_backed)
107 {
108 struct address_space *mapping = backup->f_mapping;
109 int nr_pages = 1 << order;
110 struct folio *to_folio;
111 int ret, i;
112
113 *nr_pages_backed = 0;
114
115 for (i = 0; i < nr_pages; ) {
116 int to_nr, j;
117
118 /*
119 * Only inject past the first subpage so *nr_pages_backed is
120 * always > 0 here, matching a genuine mid-compound -ENOMEM
121 * and driving the caller's reactive split fallback instead
122 * of an early, no-progress failure.
123 */
124 if (IS_ENABLED(CONFIG_FAULT_INJECTION) && i &&
125 ttm_backup_fault_inject_folio())
126 to_folio = ERR_PTR(-ENOMEM);
127 else
128 to_folio = shmem_read_folio_gfp(mapping, idx + i, alloc_gfp);
129 if (IS_ERR(to_folio)) {
130 int err = PTR_ERR(to_folio);
131
132 if (err == -ENOMEM && *nr_pages_backed)
133 return ttm_backup_shmem_idx_to_handle(idx);
134
135 if (*nr_pages_backed) {
136 shmem_truncate_range(file_inode(backup),
137 (loff_t)idx << PAGE_SHIFT,
138 ((loff_t)(idx + i) << PAGE_SHIFT) - 1);
139 /*
140 * The pages just truncated are no longer
141 * backed up; don't let the caller mistake
142 * them for valid handles.
143 */
144 *nr_pages_backed = 0;
145 }
146 return err;
147 }
148
149 to_nr = min_t(int, nr_pages - i,
150 folio_next_index(to_folio) - (idx + i));
151
152 folio_mark_accessed(to_folio);
153 folio_lock(to_folio);
154 folio_mark_dirty(to_folio);
155
156 for (j = 0; j < to_nr; j++)
157 copy_highpage(folio_file_page(to_folio, idx + i + j),
158 folio_page(folio, i + j));
159
160 if (writeback && !folio_mapped(to_folio) &&
161 folio_clear_dirty_for_io(to_folio)) {
162 folio_set_reclaim(to_folio);
> 163 ret = shmem_write_folio(to_folio);
164 if (!folio_test_writeback(to_folio))
165 folio_clear_reclaim(to_folio);
166 if (ret == AOP_WRITEPAGE_ACTIVATE)
167 folio_unlock(to_folio);
168 } else {
169 folio_unlock(to_folio);
170 }
171
172 folio_put(to_folio);
173 i += to_nr;
174 *nr_pages_backed = i;
175 }
176
177 return ttm_backup_shmem_idx_to_handle(idx);
178 }
179
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-07-29 14:48 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=202607291606.s2Hw3kEj-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=hch@lst.de \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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