public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.vnet.ibm.com>
Cc: KVM <kvm@vger.kernel.org>, Cornelia Huck <cohuck@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH 2/2] s390/gmap: make gmap memcg aware
Date: Tue, 17 Nov 2020 16:22:31 +0100	[thread overview]
Message-ID: <fd9f77d2-fdd1-d2ab-d9ca-ee914ac9deaf@linux.ibm.com> (raw)
In-Reply-To: <20201117151023.424575-3-borntraeger@de.ibm.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 5280 bytes --]

On 11/17/20 4:10 PM, Christian Borntraeger wrote:
> gmap allocations can be attributed to a process.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Acked-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/mm/gmap.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index 64795d034926..9bb2c7512cd5 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -2,7 +2,7 @@
>  /*
>   *  KVM guest address space mapping code
>   *
> - *    Copyright IBM Corp. 2007, 2016, 2018
> + *    Copyright IBM Corp. 2007, 2020

Do you mean 2007 - 2020 or did you drop the 2016 and 2018?
How does this even work?

Acked-by: Janosch Frank <frankja@linux.ibm.com>


>   *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
>   *		 David Hildenbrand <david@redhat.com>
>   *		 Janosch Frank <frankja@linux.vnet.ibm.com>
> @@ -56,19 +56,19 @@ static struct gmap *gmap_alloc(unsigned long limit)
>  		atype = _ASCE_TYPE_REGION1;
>  		etype = _REGION1_ENTRY_EMPTY;
>  	}
> -	gmap = kzalloc(sizeof(struct gmap), GFP_KERNEL);
> +	gmap = kzalloc(sizeof(struct gmap), GFP_KERNEL_ACCOUNT);
>  	if (!gmap)
>  		goto out;
>  	INIT_LIST_HEAD(&gmap->crst_list);
>  	INIT_LIST_HEAD(&gmap->children);
>  	INIT_LIST_HEAD(&gmap->pt_list);
> -	INIT_RADIX_TREE(&gmap->guest_to_host, GFP_KERNEL);
> -	INIT_RADIX_TREE(&gmap->host_to_guest, GFP_ATOMIC);
> -	INIT_RADIX_TREE(&gmap->host_to_rmap, GFP_ATOMIC);
> +	INIT_RADIX_TREE(&gmap->guest_to_host, GFP_KERNEL_ACCOUNT);
> +	INIT_RADIX_TREE(&gmap->host_to_guest, GFP_ATOMIC | __GFP_ACCOUNT);
> +	INIT_RADIX_TREE(&gmap->host_to_rmap, GFP_ATOMIC | __GFP_ACCOUNT);
>  	spin_lock_init(&gmap->guest_table_lock);
>  	spin_lock_init(&gmap->shadow_lock);
>  	refcount_set(&gmap->ref_count, 1);
> -	page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER);
> +	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
>  	if (!page)
>  		goto out_free;
>  	page->index = 0;
> @@ -309,7 +309,7 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table,
>  	unsigned long *new;
> 
>  	/* since we dont free the gmap table until gmap_free we can unlock */
> -	page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER);
> +	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
>  	if (!page)
>  		return -ENOMEM;
>  	new = (unsigned long *) page_to_phys(page);
> @@ -594,7 +594,7 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr)
>  	if (pmd_large(*pmd) && !gmap->mm->context.allow_gmap_hpage_1m)
>  		return -EFAULT;
>  	/* Link gmap segment table entry location to page table. */
> -	rc = radix_tree_preload(GFP_KERNEL);
> +	rc = radix_tree_preload(GFP_KERNEL_ACCOUNT);
>  	if (rc)
>  		return rc;
>  	ptl = pmd_lock(mm, pmd);
> @@ -1218,11 +1218,11 @@ static int gmap_protect_rmap(struct gmap *sg, unsigned long raddr,
>  		vmaddr = __gmap_translate(parent, paddr);
>  		if (IS_ERR_VALUE(vmaddr))
>  			return vmaddr;
> -		rmap = kzalloc(sizeof(*rmap), GFP_KERNEL);
> +		rmap = kzalloc(sizeof(*rmap), GFP_KERNEL_ACCOUNT);
>  		if (!rmap)
>  			return -ENOMEM;
>  		rmap->raddr = raddr;
> -		rc = radix_tree_preload(GFP_KERNEL);
> +		rc = radix_tree_preload(GFP_KERNEL_ACCOUNT);
>  		if (rc) {
>  			kfree(rmap);
>  			return rc;
> @@ -1741,7 +1741,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t,
> 
>  	BUG_ON(!gmap_is_shadow(sg));
>  	/* Allocate a shadow region second table */
> -	page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER);
> +	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
>  	if (!page)
>  		return -ENOMEM;
>  	page->index = r2t & _REGION_ENTRY_ORIGIN;
> @@ -1825,7 +1825,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
> 
>  	BUG_ON(!gmap_is_shadow(sg));
>  	/* Allocate a shadow region second table */
> -	page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER);
> +	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
>  	if (!page)
>  		return -ENOMEM;
>  	page->index = r3t & _REGION_ENTRY_ORIGIN;
> @@ -1909,7 +1909,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt,
> 
>  	BUG_ON(!gmap_is_shadow(sg) || (sgt & _REGION3_ENTRY_LARGE));
>  	/* Allocate a shadow segment table */
> -	page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER);
> +	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
>  	if (!page)
>  		return -ENOMEM;
>  	page->index = sgt & _REGION_ENTRY_ORIGIN;
> @@ -2116,7 +2116,7 @@ int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte)
>  	parent = sg->parent;
>  	prot = (pte_val(pte) & _PAGE_PROTECT) ? PROT_READ : PROT_WRITE;
> 
> -	rmap = kzalloc(sizeof(*rmap), GFP_KERNEL);
> +	rmap = kzalloc(sizeof(*rmap), GFP_KERNEL_ACCOUNT);
>  	if (!rmap)
>  		return -ENOMEM;
>  	rmap->raddr = (saddr & PAGE_MASK) | _SHADOW_RMAP_PGTABLE;
> @@ -2128,7 +2128,7 @@ int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte)
>  			rc = vmaddr;
>  			break;
>  		}
> -		rc = radix_tree_preload(GFP_KERNEL);
> +		rc = radix_tree_preload(GFP_KERNEL_ACCOUNT);
>  		if (rc)
>  			break;
>  		rc = -EAGAIN;
> 


[-- Attachment #1.1.2: OpenPGP_0xE354E6B8E238B9F8.asc --]
[-- Type: application/pgp-keys, Size: 7995 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2020-11-17 15:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 15:10 [PATCH 0/2] KVM: s390: memcg awareness Christian Borntraeger
2020-11-17 15:10 ` [PATCH 1/2] KVM: s390: Add memcg accounting to KVM allocations Christian Borntraeger
2020-11-17 15:22   ` Janosch Frank
2020-11-23 16:08   ` Cornelia Huck
2020-11-17 15:10 ` [PATCH 2/2] s390/gmap: make gmap memcg aware Christian Borntraeger
2020-11-17 15:22   ` Janosch Frank [this message]
2020-11-17 15:31     ` Christian Borntraeger
2020-11-23 16:10   ` Cornelia Huck
2020-11-17 15:23 ` [PATCH 0/2] KVM: s390: memcg awareness David Hildenbrand
2020-11-23 17:15 ` Christian Borntraeger

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=fd9f77d2-fdd1-d2ab-d9ca-ee914ac9deaf@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /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