Skip to content

Commit c654345

Browse files
Rik van Rieltorvalds
authored andcommitted
mm: remove __GFP_NO_KSWAPD
When transparent huge pages were introduced, memory compaction and swap storms were an issue, and the kernel had to be careful to not make THP allocations cause pageout or compaction. Now that we have working compaction deferral, kswapd is smart enough to invoke compaction and the quadratic behaviour around isolate_free_pages has been fixed, it should be safe to remove __GFP_NO_KSWAPD. [minchan@kernel.org: Comment fix] [mgorman@suse.de: Avoid direct reclaim for deferred compaction] Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 075663d commit c654345

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

drivers/mtd/mtdcore.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,7 @@ EXPORT_SYMBOL_GPL(mtd_writev);
10561056
* until the request succeeds or until the allocation size falls below
10571057
* the system page size. This attempts to make sure it does not adversely
10581058
* impact system performance, so when allocating more than one page, we
1059-
* ask the memory allocator to avoid re-trying, swapping, writing back
1060-
* or performing I/O.
1059+
* ask the memory allocator to avoid re-trying.
10611060
*
10621061
* Note, this function also makes sure that the allocated buffer is aligned to
10631062
* the MTD device's min. I/O unit, i.e. the "mtd->writesize" value.
@@ -1071,8 +1070,7 @@ EXPORT_SYMBOL_GPL(mtd_writev);
10711070
*/
10721071
void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size)
10731072
{
1074-
gfp_t flags = __GFP_NOWARN | __GFP_WAIT |
1075-
__GFP_NORETRY | __GFP_NO_KSWAPD;
1073+
gfp_t flags = __GFP_NOWARN | __GFP_WAIT | __GFP_NORETRY;
10761074
size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE);
10771075
void *kbuf;
10781076

include/linux/gfp.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct vm_area_struct;
3535
#else
3636
#define ___GFP_NOTRACK 0
3737
#endif
38-
#define ___GFP_NO_KSWAPD 0x400000u
3938
#define ___GFP_OTHER_NODE 0x800000u
4039
#define ___GFP_WRITE 0x1000000u
4140

@@ -90,7 +89,6 @@ struct vm_area_struct;
9089
#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
9190
#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
9291

93-
#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
9492
#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
9593
#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
9694

@@ -120,8 +118,7 @@ struct vm_area_struct;
120118
__GFP_MOVABLE)
121119
#define GFP_IOFS (__GFP_IO | __GFP_FS)
122120
#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
123-
__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
124-
__GFP_NO_KSWAPD)
121+
__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN)
125122

126123
#ifdef CONFIG_NUMA
127124
#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)

include/trace/events/gfpflags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
{(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
3737
{(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
3838
{(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
39-
{(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
4039
{(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \
4140
) : "GFP_NOWAIT"
4241

mm/page_alloc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,9 +2362,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
23622362
goto nopage;
23632363

23642364
restart:
2365-
if (!(gfp_mask & __GFP_NO_KSWAPD))
2366-
wake_all_kswapd(order, zonelist, high_zoneidx,
2367-
zone_idx(preferred_zone));
2365+
wake_all_kswapd(order, zonelist, high_zoneidx,
2366+
zone_idx(preferred_zone));
23682367

23692368
/*
23702369
* OK, we're below the kswapd watermark and have kicked background
@@ -2441,7 +2440,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
24412440
* system then fail the allocation instead of entering direct reclaim.
24422441
*/
24432442
if ((deferred_compaction || contended_compaction) &&
2444-
(gfp_mask & __GFP_NO_KSWAPD))
2443+
(gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE)
24452444
goto nopage;
24462445

24472446
/* Try direct reclaim and then allocating */

0 commit comments

Comments
 (0)