lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <78427916-fc17-b081-6b1e-cbcb00d51752@redhat.com>
Date:   Tue, 10 Mar 2020 12:12:50 +0100
From:   David Hildenbrand <david@...hat.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        virtualization@...ts.linux-foundation.org,
        Jason Wang <jasowang@...hat.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Tyler Sanderson <tysand@...gle.com>,
        Wei Wang <wei.w.wang@...el.com>,
        Alexander Duyck <alexander.h.duyck@...ux.intel.com>,
        David Rientjes <rientjes@...gle.com>,
        Nadav Amit <namit@...are.com>,
        Michal Hocko <mhocko@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] virtio-balloon: Switch back to OOM handler for
 VIRTIO_BALLOON_F_DEFLATE_ON_OOM

>>  static void virtio_balloon_unregister_shrinker(struct virtio_balloon *vb)
>> @@ -971,7 +950,22 @@ static int virtballoon_probe(struct virtio_device *vdev)
>>  						  VIRTIO_BALLOON_CMD_ID_STOP);
>>  		spin_lock_init(&vb->free_page_list_lock);
>>  		INIT_LIST_HEAD(&vb->free_page_list);
>> +		/*
>> +		 * We're allowed to reuse any free pages, even if they are
>> +		 * still to be processed by the host.
>> +		 */
>> +		err = virtio_balloon_register_shrinker(vb);
>> +		if (err)
>> +			goto out_del_balloon_wq;
>>  	}
>> +	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) {
>> +		vb->oom_nb.notifier_call = virtio_balloon_oom_notify;
>> +		vb->oom_nb.priority = VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY;
>> +		err = register_oom_notifier(&vb->oom_nb);
>> +		if (err < 0)
>> +			goto out_unregister_shrinker;
>> +	}
>> +
> 
> 
> Let's decide whether we want an empty line after }, or not, and stick to
> it. I prefer an empty line but no biggie as long as we are consistent.

Can add one.

> 
>>  	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) {
>>  		/* Start with poison val of 0 representing general init */
>>  		__u32 poison_val = 0;
>> @@ -986,15 +980,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
>>  		virtio_cwrite(vb->vdev, struct virtio_balloon_config,
>>  			      poison_val, &poison_val);
>>  	}
>> -	/*
>> -	 * We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a
>> -	 * shrinker needs to be registered to relieve memory pressure.
>> -	 */
>> -	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) {
>> -		err = virtio_balloon_register_shrinker(vb);
>> -		if (err)
>> -			goto out_del_balloon_wq;
>> -	}
>>  
>>  	vb->pr_dev_info.report = virtballoon_free_page_report;
>>  	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING)) {
>> @@ -1003,12 +988,12 @@ static int virtballoon_probe(struct virtio_device *vdev)
>>  		capacity = virtqueue_get_vring_size(vb->reporting_vq);
>>  		if (capacity < PAGE_REPORTING_CAPACITY) {
>>  			err = -ENOSPC;
>> -			goto out_unregister_shrinker;
>> +			goto out_unregister_oom;
>>  		}
>>  
>>  		err = page_reporting_register(&vb->pr_dev_info);
>>  		if (err)
>> -			goto out_unregister_shrinker;
>> +			goto out_unregister_oom;
>>  	}
>>  
>>  	virtio_device_ready(vdev);
>> @@ -1017,8 +1002,11 @@ static int virtballoon_probe(struct virtio_device *vdev)
>>  		virtballoon_changed(vdev);
>>  	return 0;
>>  
>> +out_unregister_oom:
>> +	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
>> +		unregister_oom_notifier(&vb->oom_nb);
>>  out_unregister_shrinker:
>> -	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
>> +	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
>>  		virtio_balloon_unregister_shrinker(vb);
> 
> 
> What's with vdev versus vb->vdev here?
> I suggest we keep using vb->vdev to make the patch minimal if we can.
> Same elsewhere.

As we touch this line either way, does it really make a difference? No
strong opinion. Can just do a vb->vdev and clean this up globally later.


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ