Skip to content

Commit 453f85d

Browse files
gormanmtorvalds
authored andcommitted
mm: remove __GFP_COLD
As the page free path makes no distinction between cache hot and cold pages, there is no real useful ordering of pages in the free list that allocation requests can take advantage of. Juding from the users of __GFP_COLD, it is likely that a number of them are the result of copying other sites instead of actually measuring the impact. Remove the __GFP_COLD parameter which simplifies a number of paths in the page allocator. This is potentially controversial but bear in mind that the size of the per-cpu pagelists versus modern cache sizes means that the whole per-cpu list can often fit in the L3 cache. Hence, there is only a potential benefit for microbenchmarks that alloc/free pages in a tight loop. It's even worse when THP is taken into account which has little or no chance of getting a cache-hot page as the per-cpu list is bypassed and the zeroing of multiple pages will thrash the cache anyway. The truncate microbenchmarks are not shown as this patch affects the allocation path and not the free path. A page fault microbenchmark was tested but it showed no sigificant difference which is not surprising given that the __GFP_COLD branches are a miniscule percentage of the fault path. Link: http://lkml.kernel.org/r/20171018075952.10627-9-mgorman@techsingularity.net Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Andi Kleen <ak@linux.intel.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Jan Kara <jack@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2d4894b commit 453f85d

25 files changed

Lines changed: 32 additions & 62 deletions

File tree

‎drivers/net/ethernet/amazon/ena/ena_netdev.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num)
517517

518518

519519
rc = ena_alloc_rx_page(rx_ring, rx_info,
520-
__GFP_COLD | GFP_ATOMIC | __GFP_COMP);
520+
GFP_ATOMIC | __GFP_COMP);
521521
if (unlikely(rc < 0)) {
522522
netif_warn(rx_ring->adapter, rx_err, rx_ring->netdev,
523523
"failed to alloc buffer for rx queue %d\n",

‎drivers/net/ethernet/amd/xgbe/xgbe-desc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata,
295295
order = alloc_order;
296296

297297
/* Try to obtain pages, decreasing order if necessary */
298-
gfp = GFP_ATOMIC | __GFP_COLD | __GFP_COMP | __GFP_NOWARN;
298+
gfp = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN;
299299
while (order >= 0) {
300300
pages = alloc_pages_node(node, gfp, order);
301301
if (pages)

‎drivers/net/ethernet/aquantia/atlantic/aq_ring.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ int aq_ring_rx_fill(struct aq_ring_s *self)
304304
buff->flags = 0U;
305305
buff->len = AQ_CFG_RX_FRAME_MAX;
306306

307-
buff->page = alloc_pages(GFP_ATOMIC | __GFP_COLD |
308-
__GFP_COMP, pages_order);
307+
buff->page = alloc_pages(GFP_ATOMIC | __GFP_COMP, pages_order);
309308
if (!buff->page) {
310309
err = -ENOMEM;
311310
goto err_exit;

‎drivers/net/ethernet/cavium/liquidio/octeon_network.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static inline void
195195
struct sk_buff *skb;
196196
struct octeon_skb_page_info *skb_pg_info;
197197

198-
page = alloc_page(GFP_ATOMIC | __GFP_COLD);
198+
page = alloc_page(GFP_ATOMIC);
199199
if (unlikely(!page))
200200
return NULL;
201201

‎drivers/net/ethernet/mellanox/mlx4/en_rx.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int mlx4_en_fill_rx_buffers(struct mlx4_en_priv *priv)
193193

194194
if (mlx4_en_prepare_rx_desc(priv, ring,
195195
ring->actual_size,
196-
GFP_KERNEL | __GFP_COLD)) {
196+
GFP_KERNEL)) {
197197
if (ring->actual_size < MLX4_EN_MIN_RX_SIZE) {
198198
en_err(priv, "Failed to allocate enough rx buffers\n");
199199
return -ENOMEM;
@@ -552,8 +552,7 @@ static void mlx4_en_refill_rx_buffers(struct mlx4_en_priv *priv,
552552
do {
553553
if (mlx4_en_prepare_rx_desc(priv, ring,
554554
ring->prod & ring->size_mask,
555-
GFP_ATOMIC | __GFP_COLD |
556-
__GFP_MEMALLOC))
555+
GFP_ATOMIC | __GFP_MEMALLOC))
557556
break;
558557
ring->prod++;
559558
} while (likely(--missing));

‎drivers/net/ethernet/netronome/nfp/nfp_net_common.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ static void *nfp_net_rx_alloc_one(struct nfp_net_dp *dp, dma_addr_t *dma_addr)
11851185
} else {
11861186
struct page *page;
11871187

1188-
page = alloc_page(GFP_KERNEL | __GFP_COLD);
1188+
page = alloc_page(GFP_KERNEL);
11891189
frag = page ? page_address(page) : NULL;
11901190
}
11911191
if (!frag) {
@@ -1212,7 +1212,7 @@ static void *nfp_net_napi_alloc_one(struct nfp_net_dp *dp, dma_addr_t *dma_addr)
12121212
} else {
12131213
struct page *page;
12141214

1215-
page = alloc_page(GFP_ATOMIC | __GFP_COLD);
1215+
page = alloc_page(GFP_ATOMIC);
12161216
frag = page ? page_address(page) : NULL;
12171217
}
12181218
if (!frag) {

‎drivers/net/ethernet/qlogic/qlge/qlge_main.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,7 @@ static int ql_get_next_chunk(struct ql_adapter *qdev, struct rx_ring *rx_ring,
10921092
{
10931093
if (!rx_ring->pg_chunk.page) {
10941094
u64 map;
1095-
rx_ring->pg_chunk.page = alloc_pages(__GFP_COLD | __GFP_COMP |
1096-
GFP_ATOMIC,
1095+
rx_ring->pg_chunk.page = alloc_pages(__GFP_COMP | GFP_ATOMIC,
10971096
qdev->lbq_buf_order);
10981097
if (unlikely(!rx_ring->pg_chunk.page)) {
10991098
netif_err(qdev, drv, qdev->ndev,

‎drivers/net/ethernet/sfc/falcon/rx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int ef4_init_rx_buffers(struct ef4_rx_queue *rx_queue, bool atomic)
163163
do {
164164
page = ef4_reuse_page(rx_queue);
165165
if (page == NULL) {
166-
page = alloc_pages(__GFP_COLD | __GFP_COMP |
166+
page = alloc_pages(__GFP_COMP |
167167
(atomic ? GFP_ATOMIC : GFP_KERNEL),
168168
efx->rx_buffer_order);
169169
if (unlikely(page == NULL))

‎drivers/net/ethernet/sfc/rx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue, bool atomic)
163163
do {
164164
page = efx_reuse_page(rx_queue);
165165
if (page == NULL) {
166-
page = alloc_pages(__GFP_COLD | __GFP_COMP |
166+
page = alloc_pages(__GFP_COMP |
167167
(atomic ? GFP_ATOMIC : GFP_KERNEL),
168168
efx->rx_buffer_order);
169169
if (unlikely(page == NULL))

‎drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int xlgmac_alloc_pages(struct xlgmac_pdata *pdata,
335335
dma_addr_t pages_dma;
336336

337337
/* Try to obtain pages, decreasing order if necessary */
338-
gfp |= __GFP_COLD | __GFP_COMP | __GFP_NOWARN;
338+
gfp |= __GFP_COMP | __GFP_NOWARN;
339339
while (order >= 0) {
340340
pages = alloc_pages(gfp, order);
341341
if (pages)

0 commit comments

Comments
 (0)