Re: [PATCH v1 09/29] virtio-mem: don't always trigger the workqueue when offlining memory

2020-10-19 Thread Wei Yang
On Mon, Oct 19, 2020 at 11:04:40AM +0200, David Hildenbrand wrote: >On 18.10.20 05:57, Wei Yang wrote: >> On Fri, Oct 16, 2020 at 11:18:39AM +0200, David Hildenbrand wrote: >>> On 16.10.20 06:03, Wei Yang wrote: >>>> On Mon, Oct 12, 2020 at 02:53:03PM +0200, David

Re: [PATCH v1 29/29] virtio-mem: Big Block Mode (BBM) - safe memory hotunplug

2020-10-19 Thread Wei Yang
. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Wei Yang >Cc: Andrew Morton >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

Re: [PATCH v1 29/29] virtio-mem: Big Block Mode (BBM) - safe memory hotunplug

2020-10-19 Thread Wei Yang
On Mon, Oct 19, 2020 at 10:50:39AM +0200, David Hildenbrand wrote: >On 19.10.20 09:54, Wei Yang wrote: >> On Mon, Oct 12, 2020 at 02:53:23PM +0200, David Hildenbrand wrote: >>> Let's add a safe mechanism to unplug memory, avoiding long/endless loops >>> when trying

Re: [PATCH v1 29/29] virtio-mem: Big Block Mode (BBM) - safe memory hotunplug

2020-10-19 Thread Wei Yang
mem.bbm_safe_unplug=0 >on the cmdline. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Wei Yang >Cc: Andrew Morton >Signed-off-by: David Hildenbrand >--- > drivers/virtio/virtio_mem.c | 97 ++

Re: [PATCH v1 28/29] virtio-mem: Big Block Mode (BBM) - basic memory hotunplug

2020-10-18 Thread Wei Yang
n explicitly enabled. > >Note2: Without ZONE_MOVABLE, memory unplug will be extremely unreliable >with bigger block sizes. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Wei Yang >Cc

Re: [PATCH v1 27/29] mm/memory_hotplug: extend offline_and_remove_memory() to handle more than one memory block

2020-10-18 Thread Wei Yang
es all memory in case >something goes wrong. It doesn't restore previous online type. Let's do >that, so we won't overwrite what e.g., user space configured. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >C

Re: [PATCH v1 25/29] virtio-mem: Big Block Mode (BBM) memory hotplug

2020-10-18 Thread Wei Yang
ichael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Wei Yang >Cc: Andrew Morton >Signed-off-by: David Hildenbrand >--- > drivers/virtio/virtio_mem.c | 484 ++-- > 1 file changed, 4

Re: [PATCH v1 21/29] virtio-mem: memory notifier callbacks are specific to Sub Block Mode (SBM)

2020-10-18 Thread Wei Yang
xxx() if (vm->in_sbm) return notify_xxx() if (vm->in_sbm) return This style looks a little better to me. -- Wei Yang Help you, Help me

Re: [PATCH v1 00/29] virtio-mem: Big Block Mode (BBM)

2020-10-18 Thread Wei Yang
set, while found I can't 'git fetch' this repo. Is there any other repo I would apply this patch set? -- Wei Yang Help you, Help me

Re: [PATCH v1 20/29] virtio-mem: nb_sb_per_mb and subblock_size are specific to Sub Block Mode (SBM)

2020-10-18 Thread Wei Yang
On Fri, Oct 16, 2020 at 03:17:06PM +0200, David Hildenbrand wrote: >On 16.10.20 10:53, Wei Yang wrote: >> On Mon, Oct 12, 2020 at 02:53:14PM +0200, David Hildenbrand wrote: >>> Let's rename to "sbs_per_mb" and "sb_size" and move accordingly. >>> &

Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier

2020-10-18 Thread Wei Yang
Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 73 + > 1 file changed, 50 insertions(+), 23 deletions(-) > >diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c >index d132bc

Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier

2020-10-18 Thread Wei Yang
eep pages fake offline when onlining memory, they > >a) Have a refcount of 1 >b) Have *not* increased the managed page count > >2. alloc_contig_range(), if fake offlined. After we fake-offlined pages >(e.g., patch #12), such pages > >a) Have a refcount of 1 >b) Have *not* increased the managed page count (because we manually >decreased it) > Yep, I got the reason now. > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-18 Thread Wei Yang
On Sat, Oct 17, 2020 at 09:39:38AM +0200, David Hildenbrand wrote: > >> Am 17.10.2020 um 00:38 schrieb Wei Yang : >> >> On Fri, Oct 16, 2020 at 12:32:50PM +0200, David Hildenbrand wrote: >>>>>> Ok, I seems to understand the logic now. >>>>>&g

Re: [PATCH v1 09/29] virtio-mem: don't always trigger the workqueue when offlining memory

2020-10-17 Thread Wei Yang
On Fri, Oct 16, 2020 at 11:18:39AM +0200, David Hildenbrand wrote: >On 16.10.20 06:03, Wei Yang wrote: >> On Mon, Oct 12, 2020 at 02:53:03PM +0200, David Hildenbrand wrote: >>> Let's trigger from offlining code when we're not allowed to touch online Here "touch" me

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-16 Thread Wei Yang
easily at hand. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 19 +++ > 1 file changed, 15 insertions(+), 4 deletions(-) > >di

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-16 Thread Wei Yang
rtial-onlined pages is (PageOffline && page_count) And your commit aa218795cb5fd583c94f mm: Allow to offline unmovable PageOffline() pages via MEM_GOING_OFFLINE is introduced to handle this case. That's pretty clear now. >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-16 Thread Wei Yang
ile all of them adjust page's flag. >> How they hold reference to struct page? > >Sorry, I should have given you the right pointer. (similar to my other >reply) > >We hold a reference either via > >1. alloc_contig_range() I am not familiar with this one, need to spend some time to look into. >2. memmap init code, when not calling generic_online_page(). I may miss some code here. Before online pages, memmaps are allocated in section_activate(). They are supposed to be zero-ed. (I don't get the exact code line.) I am not sure when we grab a refcount here. > >So these fake-offline pages can never be actually offlined, because we >no longer have the memory notifier registered to fix that up. > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

Re: [PATCH v1 25/29] virtio-mem: Big Block Mode (BBM) memory hotplug

2020-10-16 Thread Wei Yang
ichael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Wei Yang >Cc: Andrew Morton >Signed-off-by: David Hildenbrand >--- > drivers/virtio/virtio_mem.c | 484 ++-- > 1 file changed, 4

Re: [PATCH v1 24/29] virtio-mem: print debug messages from virtio_mem_send_*_request()

2020-10-16 Thread Wei Yang
Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 50 ++--- > 1 file changed, 35 insertions(+), 15 deletions(-) > >diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c >index

Re: [PATCH v1 23/29] virtio-mem: factor out adding/removing memory from Linux

2020-10-16 Thread Wei Yang
ankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 107 > 1 file changed, 73 insertions(+), 34 deletions(-) > >diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c >index d

Re: [PATCH v1 22/29] virtio-mem: memory block ids are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:16PM +0200, David Hildenbrand wrote: >Let's move first_mb_id/next_mb_id/last_usable_mb_id accordingly. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- >

Re: [PATCH v1 20/29] virtio-mem: nb_sb_per_mb and subblock_size are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
,11 @@ static int virtio_mem_init(struct virtio_mem *vm) >* - Is required for now for alloc_contig_range() to work reliably - >* it doesn't properly handle smaller granularity on ZONE_NORMAL. >*/ >- vm->subblock_size = max_t(uint64_t, MAX_ORDER_NR_PAGES, >-pageblock_nr_pages) * PAGE_SIZE; >- vm->subblock_size = max_t(uint64_t, vm->device_block_size, >-vm->subblock_size); >- vm->nb_sb_per_mb = memory_block_size_bytes() / vm->subblock_size; >+ vm->sbm.sb_size = max_t(uint64_t, MAX_ORDER_NR_PAGES, >+ pageblock_nr_pages) * PAGE_SIZE; >+ vm->sbm.sb_size = max_t(uint64_t, vm->device_block_size, >+ vm->sbm.sb_size); >+ vm->sbm.sbs_per_mb = memory_block_size_bytes() / vm->sbm.sb_size; > > /* Round up to the next full memory block */ > vm->first_mb_id = virtio_mem_phys_to_mb_id(vm->addr - 1 + >@@ -1827,7 +1827,7 @@ static int virtio_mem_init(struct virtio_mem *vm) > dev_info(>vdev->dev, "memory block size: 0x%lx", >memory_block_size_bytes()); > dev_info(>vdev->dev, "subblock size: 0x%llx", >- (unsigned long long)vm->subblock_size); >+ (unsigned long long)vm->sbm.sb_size); > if (vm->nid != NUMA_NO_NODE && IS_ENABLED(CONFIG_NUMA)) > dev_info(>vdev->dev, "nid: %d", vm->nid); > >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 20/29] virtio-mem: nb_sb_per_mb and subblock_size are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:14PM +0200, David Hildenbrand wrote: >Let's rename to "sbs_per_mb" and "sb_size" and move accordingly. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: We

Re: [PATCH v1 19/29] virito-mem: existing (un)plug functions are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
y: David Hildenbrand The code is correct, while the naming is a bit long to understand... Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 90 ++--- > 1 file changed, 43 insertions(+), 47 deletions(-) > >diff --git a/drivers/virtio/vir

Re: [PATCH v1 18/29] virtio-mem: factor out calculation of the bit number within the sb_states bitmap

2020-10-16 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:12PM +0200, David Hildenbrand wrote: >The calculation is already complicated enough, let's limit it to one >location. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: W

Re: [PATCH v1 16/29] virtio-mem: memory block states are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
uot;uint8_t" > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 215 ++-- > 1 file changed, 109 insertions(+), 106 deletion

Re: [PATCH v1 17/29] virito-mem: subblock states are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
k, you separate the change into two parts. Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 118 +++- > 1 file changed, 62 insertions(+), 56 deletions(-) > >diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c >in

Re: [PATCH v1 16/29] virtio-mem: memory block states are specific to Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
sb); > if (rc || !nb_sb) >@@ -1578,11 +1579,12 @@ static int virtio_mem_unplug_pending_mb(struct >virtio_mem *vm) > unsigned long mb_id; > int rc; > >- virtio_mem_for_each_mb_state(vm, mb_id, VIRTIO_MEM_MB_STATE_PLUGGED) { >+ virtio_mem_sbm_for_each_mb(vm, mb_id, VIRTIO_MEM_SBM_MB_PLUGGED) { > rc = virtio_mem_mb_unplug(vm, mb_id); > if (rc) > return rc; >- virtio_mem_mb_set_state(vm, mb_id, VIRTIO_MEM_MB_STATE_UNUSED); >+ virtio_mem_sbm_set_mb_state(vm, mb_id, >+ VIRTIO_MEM_SBM_MB_UNUSED); > } > > return 0; >@@ -1974,11 +1976,12 @@ static void virtio_mem_remove(struct virtio_device >*vdev) >* After we unregistered our callbacks, user space can online partially >* plugged offline blocks. Make sure to remove them. >*/ >- virtio_mem_for_each_mb_state(vm, mb_id, >- VIRTIO_MEM_MB_STATE_OFFLINE_PARTIAL) { >+ virtio_mem_sbm_for_each_mb(vm, mb_id, >+ VIRTIO_MEM_SBM_MB_OFFLINE_PARTIAL) { > rc = virtio_mem_mb_remove(vm, mb_id); > BUG_ON(rc); >- virtio_mem_mb_set_state(vm, mb_id, VIRTIO_MEM_MB_STATE_UNUSED); >+ virtio_mem_sbm_set_mb_state(vm, mb_id, >+ VIRTIO_MEM_SBM_MB_UNUSED); > } > /* >* After we unregistered our callbacks, user space can no longer >@@ -2003,7 +2006,7 @@ static void virtio_mem_remove(struct virtio_device *vdev) > } > > /* remove all tracking data - no locking needed */ >- vfree(vm->mb_state); >+ vfree(vm->sbm.mb_states); > vfree(vm->sb_bitmap); > > /* reset the device and cleanup the queues */ >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 15/29] virito-mem: document Sub Block Mode (SBM)

2020-10-16 Thread Wei Yang
mplement Device Block Mode (DBM). > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 15 +++ > 1 file changed, 15 insertions(+) > >di

Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier

2020-10-16 Thread Wei Yang
On Fri, Oct 16, 2020 at 03:15:03PM +0800, Wei Yang wrote: >On Mon, Oct 12, 2020 at 02:53:07PM +0200, David Hildenbrand wrote: >>Let's factor out the core pieces and place the implementation next to >>virtio_mem_fake_offline(). We'll reuse this functionality soon. >> >

Re: [PATCH v1 13/29] virtio-mem: factor out handling of fake-offline pages in memory notifier

2020-10-16 Thread Wei Yang
nr_pages) >+{ >+ unsigned long i; >+ >+ /* >+ * Get the reference we dropped when going offline and subtract the >+ * unplugged pages from the managed page counters. >+ */ >+ adjust_managed_page_count(pfn_to_page(pfn), -nr_pages); >+ for (i = 0; i < nr_pages; i++) >+ page_ref_inc(pfn_to_page(pfn + i)); >+} >+ > static void virtio_mem_online_page_cb(struct page *page, unsigned int order) > { > const unsigned long addr = page_to_phys(page); >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 12/29] virtio-mem: factor out fake-offlining into virtio_mem_fake_offline()

2020-10-16 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:06PM +0200, David Hildenbrand wrote: >... which now matches virtio_mem_fake_online(). We'll reuse this >functionality soon. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewe

Re: [PATCH v1 11/29] virtio-mem: use "unsigned long" for nr_pages when fake onlining/offlining

2020-10-16 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:05PM +0200, David Hildenbrand wrote: >No harm done, but let's be consistent. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_m

Re: [PATCH v1 09/29] virtio-mem: don't always trigger the workqueue when offlining memory

2020-10-15 Thread Wei Yang
ic int virtio_mem_memory_notifier_cb(struct >notifier_block *nb, > break; > case MEM_OFFLINE: > virtio_mem_notify_offline(vm, mb_id); >+ >+ /* >+ * Trigger the workqueue. Now that we have some offline memory, >+ * maybe we can handle pending unplug requests. >+ */ >+ if (!unplug_online) >+ virtio_mem_retry(vm); >+ > vm->hotplug_active = false; > mutex_unlock(>hotplug_mutex); > break; >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-15 Thread Wei Yang
page? >I tried to document that via > >"After we unregistered our callbacks, user space can no longer offline >partially plugged online memory blocks. No need to worry about them." > > >> >> Thanks in advance, since I may missed some concepts. > >(force) driver unloading is a complicated corner case. > >Thanks! > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

Re: [PATCH v1 02/29] virtio-mem: simplify calculation in virtio_mem_mb_state_prepare_next_mb()

2020-10-15 Thread Wei Yang
On Thu, Oct 15, 2020 at 10:00:15AM +0200, David Hildenbrand wrote: >On 15.10.20 06:02, Wei Yang wrote: >> On Mon, Oct 12, 2020 at 02:52:56PM +0200, David Hildenbrand wrote: >>> We actually need one byte less (next_mb_id is exclusive, first_mb_id is >>> inclusive). Simpl

Re: [PATCH v1 08/29] virtio-mem: drop last_mb_id

2020-10-15 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:53:02PM +0200, David Hildenbrand wrote: >No longer used, let's drop it. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand If above two patches are merged. Reviewed-by: Wei Yang >--- &g

Re: [PATCH v1 06/29] virtio-mem: generalize virtio_mem_owned_mb()

2020-10-15 Thread Wei Yang
_mem_online_page_cb(struct page *page, >unsigned int order) >*/ > rcu_read_lock(); > list_for_each_entry_rcu(vm, _mem_devices, next) { >- if (!virtio_mem_owned_mb(vm, mb_id)) >+ if (!virtio_mem_contains_range(vm, addr, PFN_PHYS(1 << order))) > continue; > > sb_id = virtio_mem_phys_to_sb_id(vm, addr); >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 05/29] virtio-mem: generalize check for added memory

2020-10-15 Thread Wei Yang
ou do virtio_mem_mb_remove() on OFFLINE_PARTIAL memory block? Since we wait for the workqueue finish its job. Also, during virtio_mem_remove(), we just handle OFFLINE_PARTIAL memory block. How about memory block in other states? It is not necessary to remove ONLINE[_PARTIAL] memroy blocks? Thanks in advance, since I may missed some concepts. >-- >2.26.2 -- Wei Yang Help you, Help me

Re: [PATCH v1 04/29] virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()

2020-10-15 Thread Wei Yang
On Mon, Oct 12, 2020 at 02:52:58PM +0200, David Hildenbrand wrote: >We can drop rc2, we don't actually need the value. > >Cc: "Michael S. Tsirkin" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

Re: [PATCH v1 03/29] virtio-mem: simplify MAX_ORDER - 1 / pageblock_order handling

2020-10-15 Thread Wei Yang
" >Cc: Jason Wang >Cc: Pankaj Gupta >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

Re: [PATCH v1 02/29] virtio-mem: simplify calculation in virtio_mem_mb_state_prepare_next_mb()

2020-10-14 Thread Wei Yang
igned long new_bytes = vm->next_mb_id - vm->first_mb_id + 2; >+ unsigned long old_bytes = vm->next_mb_id - vm->first_mb_id; >+ unsigned long new_bytes = old_bytes + 1; This is correct. So this looks more like a fix? > int old_pages = PFN_UP(old_bytes); > i

Re: [PATCH v1 01/29] virtio-mem: determine nid only once using memory_add_physaddr_to_nid()

2020-10-14 Thread Wei Yang
y: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/virtio/virtio_mem.c | 28 +++- > 1 file changed, 11 insertions(+), 17 deletions(-) > >diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c >index ba4de598f663..a1f5bf7a571a

Re: [PATCH] kernel/resource: Fix use of ternary condition in release_mem_region_adjustable

2020-10-09 Thread Wei Yang
elease_mem_region_adjustable() >never fail") >Link: https://github.com/ClangBuiltLinux/linux/issues/1159 >Signed-off-by: Nathan Chancellor Reviewed-by: Wei Yang >--- > >Presumably, this will be squashed but I included a fixes tag >nonetheless. Apologies if this has already been n

Re: [PATCH 5/6] ftrace: replace do_for_each_ftrace_rec() with for_ftrace_rec_iter()

2020-10-07 Thread Wei Yang
On Tue, Oct 06, 2020 at 10:42:17AM -0400, Steven Rostedt wrote: >On Mon, 31 Aug 2020 11:11:03 +0800 >Wei Yang wrote: > >> Now we have two similar infrastructure to iterate ftrace_page and >> dyn_ftrace: >> >> * do_for_each_ftrace_rec() >> * f

Re: [PATCH 1/6] ftrace: define seq_file only for FMODE_READ

2020-10-07 Thread Wei Yang
On Tue, Oct 06, 2020 at 10:36:38AM -0400, Steven Rostedt wrote: >On Mon, 31 Aug 2020 11:10:59 +0800 >Wei Yang wrote: > >> The purpose of the operation is to get ftrace_iterator, which is embedded >> in file or seq_file for FMODE_WRITE/FMODE_READ respectively. Since we >

Re: [PATCH v1 3/5] mm/page_alloc: always move pages to the tail of the freelist in unset_migratetype_isolate()

2020-09-30 Thread Wei Yang
On Tue, Sep 29, 2020 at 12:12:14PM +0200, David Hildenbrand wrote: >On 29.09.20 11:18, Wei Yang wrote: >> On Mon, Sep 28, 2020 at 08:21:08PM +0200, David Hildenbrand wrote: >>> Page isolation doesn't actually touch the pages, it simply isolates >>> pagebloc

Re: [PATCH v1 5/5] mm/memory_hotplug: update comment regarding zone shuffling

2020-09-29 Thread Wei Yang
>Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang >Cc: Oscar Salvador >Cc: Mike Rapoport >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > mm/memory_hotplug.c | 11 --- > 1 fi

Re: [PATCH v1 4/5] mm/page_alloc: place pages to tail in __free_pages_core()

2020-09-29 Thread Wei Yang
fter a sequence of generic_online_page() calls in the >relevant callers. > >Reviewed-by: Vlastimil Babka >Reviewed-by: Oscar Salvador >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang &

Re: [PATCH v1 3/5] mm/page_alloc: always move pages to the tail of the freelist in unset_migratetype_isolate()

2020-09-29 Thread Wei Yang
is change results in all pages getting onlined via online_pages() to >be placed to the tail of the freelist. > >Reviewed-by: Oscar Salvador >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yan

Re: [PATCH v1 2/5] mm/page_alloc: place pages to tail in __putback_isolated_page()

2020-09-29 Thread Wei Yang
larger ranges, and after >free_contig_range(). > >Reviewed-by: Alexander Duyck >Reviewed-by: Oscar Salvador >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang >Cc: Oscar Sal

Re: [PATCH v1 1/5] mm/page_alloc: convert "report" flag of __free_one_page() to a proper flag

2020-09-29 Thread Wei Yang
- should >be good enough for internal purposes. > >Reviewed-by: Alexander Duyck >Reviewed-by: Vlastimil Babka >Reviewed-by: Oscar Salvador >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei

[PATCH] cgroup: remove redundant kernfs_activate in cgroup_setup_root()

2020-09-25 Thread Wei Yang
This step is already done in rebind_subsystems(). Not necessary to do it again. Signed-off-by: Wei Yang --- kernel/cgroup/cgroup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index dd247747ec14..809b13588124 100644 --- a/kernel/cgroup

Re: [PATCH RFC 3/4] mm/page_alloc: always move pages to the tail of the freelist in unset_migratetype_isolate()

2020-09-24 Thread Wei Yang
be placed to the tail of the freelist. >> >> Cc: Andrew Morton >> Cc: Alexander Duyck >> Cc: Mel Gorman >> Cc: Michal Hocko >> Cc: Dave Hansen >> Cc: Vlastimil Babka >> Cc: Wei Yang >> Cc: Oscar Salvador >> Cc: Mike Rapopo

Re: [PATCH RFC 0/4] mm: place pages to the freelist tail when onling and undoing isolation

2020-09-23 Thread Wei Yang
onlining a bunch of blocks as zone_movable first and only later convert to >zone_normal in a controlled way when existing normal zone becomes depeted? > To be honest, David's approach is easy to understand for me. And I don't see some negative effect. >I guess it's an issue that the e.g. 128M block onlines are so disconnected from >each other it's hard to employ a strategy that works best for e.g. a whole >bunch >of GB onlined at once. But I noticed some effort towards new API, so maybe that >will be solved there too? > >> Thanks! >> >> David >> >>> >>> I was about to give it a new respin now that thw hwpoison stuff has been >>> settled. >>> >>> [1] https://patchwork.kernel.org/cover/11059175/ >>> >> -- Wei Yang Help you, Help me

[PATCH] mm/mempolicy: remove or narrow the lock on current

2020-09-20 Thread Wei Yang
It is not necessary to hold the lock of current when setting nodemask of a new policy. Signed-off-by: Wei Yang --- mm/mempolicy.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 906adc58d86f..3fde772ef5ef 100644 --- a/mm/mempolicy.c

[PATCH] mm: remove unused alloc_page_vma_node()

2020-09-20 Thread Wei Yang
No one use this macro anymore. Also fix code style of policy_node(). Signed-off-by: Wei Yang --- include/linux/gfp.h | 2 -- mm/mempolicy.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 67a0774e080b..e83cc7f5a2fc

Re: [PATCH RFC 2/4] mm/page_alloc: place pages to tail in __putback_isolated_page()

2020-09-20 Thread Wei Yang
On Fri, Sep 18, 2020 at 09:27:23AM +0200, David Hildenbrand wrote: >On 18.09.20 04:07, Wei Yang wrote: >> On Wed, Sep 16, 2020 at 08:34:09PM +0200, David Hildenbrand wrote: >>> __putback_isolated_page() already documents that pages will be placed to >>> the tail of the

Re: [PATCH RFC 2/4] mm/page_alloc: place pages to tail in __putback_isolated_page()

2020-09-17 Thread Wei Yang
ance triggering undo of isolation (e.g., alloc_contig_range(), >memory onlining, memory offlining). > >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang >Cc: Oscar Salvador >Cc: Mike Rapop

Re: [PATCH RFC 0/4] mm: place pages to the freelist tail when onling and undoing isolation

2020-09-17 Thread Wei Yang
while vmemmap on hotplugged memory would tackle some part of the issue, >there are cases where this approach is better, and there are even benefits >when combining both. While everything changes with shuffle. > >Thanks! > >David > >> >> I was about to give it a new respin now that thw hwpoison stuff has been >> settled. >> >> [1] https://patchwork.kernel.org/cover/11059175/ >> -- Wei Yang Help you, Help me

Re: [PATCH RFC 3/4] mm/page_alloc: always move pages to the tail of the freelist in unset_migratetype_isolate()

2020-09-17 Thread Wei Yang
gratetype_isolate() is used in __offline_pages if my understanding is correct. How does it contribute on online_pages? > >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang >Cc: Oscar Salvador >Cc:

Re: [PATCH RFC 2/4] mm/page_alloc: place pages to tail in __putback_isolated_page()

2020-09-17 Thread Wei Yang
isolation >behavior (which I doubt), we can always make this configurable by the >instance triggering undo of isolation (e.g., alloc_contig_range(), >memory onlining, memory offlining). > >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave

Re: [PATCH RFC 1/4] mm/page_alloc: convert "report" flag of __free_one_page() to a proper flag

2020-09-17 Thread Wei Yang
- should >be good enough for internal purposes. > >Cc: Andrew Morton >Cc: Alexander Duyck >Cc: Mel Gorman >Cc: Michal Hocko >Cc: Dave Hansen >Cc: Vlastimil Babka >Cc: Wei Yang >Cc: Oscar Salvador >Cc: Mike Rapoport >Signed-off-by: D

[PATCH] mm/mmap: do the check on expand instead of on insert

2020-09-17 Thread Wei Yang
handle the corner case(shift_arg_pages) properly, let's do the check on *expand* instead of *insert*. Signed-off-by: Wei Yang --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 829897646a9c..ca31b405fbfa 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @

Re: [PATCH] kernel/resource: make iomem_resource implicit in release_mem_region_adjustable()

2020-09-16 Thread Wei Yang
licable. > Looks good to me. Reviewed-by: Wei Yang >Suggested-by: Wei Yang >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Dan Williams >Cc: Jason Gunthorpe >Cc: Kees Cook >Cc: Ard Biesheuvel >Cc: Pankaj Gupta >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by:

Re: [PATCH v2 1/7] kernel/resource: make release_mem_region_adjustable() never fail

2020-09-15 Thread Wei Yang
On Tue, Sep 15, 2020 at 11:15:53AM +0200, David Hildenbrand wrote: >On 15.09.20 11:06, Wei Yang wrote: >> On Tue, Sep 15, 2020 at 09:35:30AM +0200, David Hildenbrand wrote: >>> >>>>> static int __ref try_remove_memory(int nid, u64 start, u64 size) >>>

Re: [PATCH v2 1/7] kernel/resource: make release_mem_region_adjustable() never fail

2020-09-15 Thread Wei Yang
or > >#define devm_release_mem_region(dev, start, n) \ > __devm_release_region(dev, _resource, (start), (n)) > What I prefer is remove iomem_resource from the parameter list. Just use is in the function body. For the example you listed, __release_region() would have varies of *paren

Re: [PATCH v4 5/8] mm/memory_hotplug: MEMHP_MERGE_RESOURCE to specify merging of System RAM resources

2020-09-14 Thread Wei Yang
" >Cc: Haiyang Zhang >Cc: Stephen Hemminger >Cc: Wei Liu >Cc: Boris Ostrovsky >Cc: Juergen Gross >Cc: Stefano Stabellini >Cc: Roger Pau Monné >Cc: Julien Grall >Cc: Pankaj Gupta >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hild

Re: [PATCH v2 2/7] kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED

2020-09-14 Thread Wei Yang
pluged memory? So we make them all in IORESOURCE_SYSRAM_XXX family? > >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Dan Williams >Cc: Jason Gunthorpe >Cc: Kees Cook >Cc: Ard Biesheuvel >Cc: Pankaj Gupta >Cc: Baoquan He >Cc: Wei Yang >Cc: Eric Biederman >Cc: Thomas Gle

Re: [PATCH v2 1/7] kernel/resource: make release_mem_region_adjustable() never fail

2020-09-14 Thread Wei Yang
: Ard Biesheuvel >Cc: Pankaj Gupta >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hildenbrand >--- > include/linux/ioport.h | 4 ++-- > kernel/resource.c | 49 -- > mm/memory_hotplug.c| 22 +-- &

Re: [PATCH v2 1/7] kernel/resource: make release_mem_region_adjustable() never fail

2020-09-14 Thread Wei Yang
: Ard Biesheuvel >Cc: Pankaj Gupta >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hildenbrand >--- > include/linux/ioport.h | 4 ++-- > kernel/resource.c | 49 -- > mm/memory_hotplug.c| 22 +-- &

Re: [Patch v2 0/4] tracing: trivial cleanup

2020-09-14 Thread Wei Yang
On Mon, Sep 14, 2020 at 06:55:28PM -0400, Steven Rostedt wrote: >On Fri, 28 Aug 2020 11:42:57 +0800 >Wei Yang wrote: > >> Steven, >> >> Would you like to pick this up? >> > >Hmm, patch 1 and 2 have been accepted (different subjects though): > >

[PATCH 2/2] mm/mmap: check on file instead of the rb_root_cached of its address_space

2020-09-13 Thread Wei Yang
if it is a file backed vma, let's just replace *root* with *file* here. Signed-off-by: Wei Yang --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 30b155098606..829897646a9c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -823,7 +823,7 @@ int

[PATCH 1/2] mm/mmap: not necessary to check mapping separately

2020-09-13 Thread Wei Yang
-off-by: Wei Yang --- mm/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 1922e6fce9e7..30b155098606 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -895,10 +895,9 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start

Re: [PATCH] mm/mmap: leave adjust_next as virtual address instead of page frame number

2020-09-08 Thread Wei Yang
On Tue, Sep 08, 2020 at 05:31:22PM +0200, Vlastimil Babka wrote: >On 8/28/20 10:10 AM, Wei Yang wrote: >> Instead of convert adjust_next between virtual address and page frame >> number, let's just store the virtual address into adjust_next. > >IMHO more precisely/less

Re: [PATCH v18 00/32] per memcg lru_lock: reviews

2020-09-08 Thread Wei Yang
this >past Kirill and Matthew and Johannes: you did so, thank you, and Kirill >has blessed it, and no one has nacked it, and I have not noticed any >disadvantage from this change in lock ordering (documented in 23/32), >so I'm now going to say > >Acked-by: Hugh Dickins &g

[Patch v4 6/7] mm/hugetlb: narrow the hugetlb_lock protection area during preparing huge page

2020-08-31 Thread Wei Yang
set_hugetlb_cgroup_[rsvd] just manipulate page local data, which is not necessary to be protected by hugetlb_lock. Let's take this out. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Patch v4 5/7] mm/hugetlb: a page from buddy is not on any list

2020-08-31 Thread Wei Yang
The page allocated from buddy is not on any list, so just use list_add() is enough. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 441b7f7c623e

[Patch v4 3/7] mm/hugetlb: use list_splice to merge two list at once

2020-08-31 Thread Wei Yang
Instead of add allocated file_region one by one to region_cache, we could use list_splice to merge two list at once. Also we know the number of entries in the list, increase the number directly. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 7

[Patch v4 7/7] mm/hugetlb: take the free hpage during the iteration directly

2020-08-31 Thread Wei Yang
Function dequeue_huge_page_node_exact() iterates the free list and return the first valid free hpage. Instead of break and check the loop variant, we could return in the loop directly. This could reduce some redundant check. Signed-off-by: Wei Yang [mike.krav...@oracle.com: points out a logic

[Patch v4 2/7] mm/hugetlb: remove VM_BUG_ON(!nrg) in get_file_region_entry_from_cache()

2020-08-31 Thread Wei Yang
We are sure to get a valid file_region, otherwise the VM_BUG_ON(resv->region_cache_count <= 0) at the very beginning would be triggered. Let's remove the redundant one. Signed-off-by: Wei Yang Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 1 - 1 file changed, 1 deletion(-) diff --gi

[Patch v4 4/7] mm/hugetlb: count file_region to be added when regions_needed != NULL

2020-08-31 Thread Wei Yang
to separate them. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a02bf430de6f..441b7f7c623e 100644 --- a/mm/hugetlb.c +++ b

[Patch v4 0/7] mm/hugetlb: code refine and simplification

2020-08-31 Thread Wei Yang
. * adjust 2 based on comment from Mike Kravetz Wei Yang (7): mm/hugetlb: not necessary to coalesce regions recursively mm/hugetlb: remove VM_BUG_ON(!nrg) in get_file_region_entry_from_cache() mm/hugetlb: use list_splice to merge two list at once mm/hugetlb: count file_region to be added when

[Patch v4 1/7] mm/hugetlb: not necessary to coalesce regions recursively

2020-08-31 Thread Wei Yang
Per my understanding, we keep the regions ordered and would always coalesce regions properly. So the task to keep this property is just to coalesce its neighbour. Let's simplify this. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 6 +- 1

Re: [Patch v3 7/7] mm/hugetlb: take the free hpage during the iteration directly

2020-08-31 Thread Wei Yang
On Mon, Aug 31, 2020 at 04:06:54PM -0700, Mike Kravetz wrote: >On 8/30/20 7:23 PM, Wei Yang wrote: >> Function dequeue_huge_page_node_exact() iterates the free list and >> return the first valid free hpage. >> >> Instead of break and check the loop variant, we could ret

[PATCH 2/6] ftrace: use fls() to get the bits for dup_hash()

2020-08-30 Thread Wei Yang
The effect here is to get the number of bits, lets use fls() to do this job. Signed-off-by: Wei Yang --- kernel/trace/ftrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 12cb535769bc..9021e16fa079 100644

[PATCH 1/6] ftrace: define seq_file only for FMODE_READ

2020-08-30 Thread Wei Yang
lid seq_file. Signed-off-by: Wei Yang --- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index edc233122598..12cb535769bc 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5558,7 +5558,6 @@ sta

[PATCH 3/6] ftrace: simplify the dyn_ftrace->flags macro

2020-08-30 Thread Wei Yang
All the three macro are defined to be used for ftrace_rec_count(). This can be achieved by (flags & FTRACE_REF_MAX) directly. Since no other places would use those macros, remove them for clarity. Also it fixes a typo in the comment. Signed-off-by: Wei Yang --- include/linux/ftrace.h

[PATCH 4/6] ftrace: simplify the calculation of page number for ftrace_page->records

2020-08-30 Thread Wei Yang
the requirement. The calculation could be simplified by lower one order level when pages are not power of 2. Signed-off-by: Wei Yang --- kernel/trace/ftrace.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9021e16fa079

[PATCH 5/6] ftrace: replace do_for_each_ftrace_rec() with for_ftrace_rec_iter()

2020-08-30 Thread Wei Yang
Now we have two similar infrastructure to iterate ftrace_page and dyn_ftrace: * do_for_each_ftrace_rec() * for_ftrace_rec_iter() The 2nd one, for_ftrace_rec_iter(), looks more generic, so preserve it and replace do_for_each_ftrace_rec() with it. Signed-off-by: Wei Yang --- kernel/trace

[PATCH 6/6] ftrace: ftrace_global_list is renamed to ftrace_ops_list

2020-08-30 Thread Wei Yang
Fix the comment to comply with the code. Signed-off-by: Wei Yang --- include/linux/ftrace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 23c4d6526998..8e1fd97343c6 100644 --- a/include/linux/ftrace.h +++ b/include

[PATCH 0/6] ftrace: trivial cleanup

2020-08-30 Thread Wei Yang
Trivial cleanups relates to ftrace. Wei Yang (6): ftrace: define seq_file only for FMODE_READ ftrace: use fls() to get the bits for dup_hash() ftrace: simplify the dyn_ftrace->flags macro ftrace: simplify the calculation of page number for ftrace_page->records ftrace: r

[Patch v3 4/7] mm/hugetlb: count file_region to be added when regions_needed != NULL

2020-08-30 Thread Wei Yang
to separate them. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a02bf430de6f..441b7f7c623e 100644 --- a/mm/hugetlb.c +++ b

[Patch v3 2/7] mm/hugetlb: remove VM_BUG_ON(!nrg) in get_file_region_entry_from_cache()

2020-08-30 Thread Wei Yang
We are sure to get a valid file_region, otherwise the VM_BUG_ON(resv->region_cache_count <= 0) at the very beginning would be triggered. Let's remove the redundant one. Signed-off-by: Wei Yang Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 1 - 1 file changed, 1 deletion(-) diff --gi

[Patch v3 3/7] mm/hugetlb: use list_splice to merge two list at once

2020-08-30 Thread Wei Yang
Instead of add allocated file_region one by one to region_cache, we could use list_splice to merge two list at once. Also we know the number of entries in the list, increase the number directly. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 7

[Patch v3 0/7] mm/hugetlb: code refine and simplification

2020-08-30 Thread Wei Yang
Following are some cleanup for hugetlb. Simple test with tools/testing/selftests/vm/map_hugetlb pass. v3: * rebase on v5.9-rc2 which adjust the last patch a little v2: * drop 5/6/10 since similar patches are merged or under review. * adjust 2 based on comment from Mike Kravetz Wei Yang (7

[Patch v3 7/7] mm/hugetlb: take the free hpage during the iteration directly

2020-08-30 Thread Wei Yang
Function dequeue_huge_page_node_exact() iterates the free list and return the first valid free hpage. Instead of break and check the loop variant, we could return in the loop directly. This could reduce some redundant check. Signed-off-by: Wei Yang --- mm/hugetlb.c | 20 1

[Patch v3 5/7] mm/hugetlb: a page from buddy is not on any list

2020-08-30 Thread Wei Yang
The page allocated from buddy is not on any list, so just use list_add() is enough. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 441b7f7c623e

[Patch v3 6/7] mm/hugetlb: narrow the hugetlb_lock protection area during preparing huge page

2020-08-30 Thread Wei Yang
set_hugetlb_cgroup_[rsvd] just manipulate page local data, which is not necessary to be protected by hugetlb_lock. Let's take this out. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Patch v3 1/7] mm/hugetlb: not necessary to coalesce regions recursively

2020-08-30 Thread Wei Yang
Per my understanding, we keep the regions ordered and would always coalesce regions properly. So the task to keep this property is just to coalesce its neighbour. Let's simplify this. Signed-off-by: Wei Yang Reviewed-by: Baoquan He Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 6 +- 1

  1   2   3   4   5   6   7   8   9   10   >